<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.socr.umich.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pineaumi</id>
	<title>SOCR - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.socr.umich.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pineaumi"/>
	<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php/Special:Contributions/Pineaumi"/>
	<updated>2026-06-04T02:14:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM&amp;diff=16252</id>
		<title>SMHS BigDataBigSci SEM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM&amp;diff=16252"/>
		<updated>2016-05-24T15:29:36Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Structural Equation Modeling (SEM) ==&lt;br /&gt;
&lt;br /&gt;
SEM allow re-parameterization of random-effects to specify latent variables that may affect measures at different time points using structural equations. SEM show variables having predictive (possibly causal) effects on other variables (denoted by arrows) where coefficients index the strength and direction of predictive relations. SEM does not offer much more than what classical regression methods do, but it does allow simultaneous estimation of multiple equations modeling complementary relations. &lt;br /&gt;
&lt;br /&gt;
SEM is a general multivariate statistical analysis technique that can be used for causal modeling/inference, path analysis, confirmatory factor analysis (CFA), covariance structure modeling, and correlation structure modeling.&lt;br /&gt;
&lt;br /&gt;
===SEM Advantages===&lt;br /&gt;
* It allows testing models with multiple dependent variables&lt;br /&gt;
* Provides mechanisms for modeling mediating variables&lt;br /&gt;
* Enables modeling of error terms&lt;br /&gt;
* acilitates modeling of challenging data  (longitudinal with auto-correlated errors, multi-level data, non-normal data, incomplete data)&lt;br /&gt;
&lt;br /&gt;
SEM allows separation of observed and latent variables. Other standard statistical procedures may be viewed as special cases of SEM, where statistical significance less important, than in other techniques, and covariances are the core of structural equation models.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
*The &amp;lt;b&amp;gt;disturbance&amp;lt;/b&amp;gt;, &amp;lt;i&amp;gt;D&amp;lt;/i&amp;gt;, is the variance in Y unexplained by a variable X that is assumed to affect Y.&lt;br /&gt;
 X    →    Y   ←     D&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Measurement error&amp;lt;/b&amp;gt;, &amp;lt;i&amp;gt;E&amp;lt;/i&amp;gt;, is the variance in X unexplained by A, where X is an observed variable that is presumed to measure a latent variable, &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt;.&lt;br /&gt;
 A    →    X   ←     E&lt;br /&gt;
&lt;br /&gt;
* Categorical variables in a model are &amp;lt;b&amp;gt;exogenous&amp;lt;/b&amp;gt; (independent) or &amp;lt;b&amp;gt;endogenous&amp;lt;/b&amp;gt; (dependent).&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
&lt;br /&gt;
* In SEM &amp;lt;b&amp;gt;observed (or manifest) indicators&amp;lt;/b&amp;gt; are represented by &amp;lt;b&amp;gt;squares/rectangles&amp;lt;/b&amp;gt; whereas latent variables (or factors) represented by circles/ovals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci1.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''Relations: Direct effects''' (&amp;amp;rarr;), '''Reciprocal effects''' (&amp;amp;harr; or &amp;amp;#8646;), and '''Correlation or covariance''' (&amp;amp;#x293B; or &amp;amp;#x293A;) all have different appearance in SEM models.&lt;br /&gt;
&lt;br /&gt;
===Model Components===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;measurement part&amp;lt;/b&amp;gt; of SEM model deals with the latent variables and their indicators. A pure measurement model is a confirmatory factor analysis (CFA) model with unmeasured covariance (bidirectional arrows) between each possible pair of latent variables. There are &amp;lt;u&amp;gt;straight arrows from the latent variables to their respective indicators and straight arrows from the error and disturbance terms to their respective variables, but no direct effects (straight arrows) connecting the latent variables&amp;lt;/u&amp;gt;. The &amp;lt;b&amp;gt;measurement model&amp;lt;/b&amp;gt; is evaluated using goodness of fit measures (Chi-Square test, BIC, AIC, etc.) &amp;lt;b&amp;gt;Validation of the measurement model is always first.&amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Then we proceed to the structural model&amp;lt;/b&amp;gt; (including a set of exogenous and endogenous variables together with the direct effects (straight arrows) connecting them along with the disturbance and error terms for these variables that reflect the effects of unmeasured variables not in the model).&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* Sample-size considerations: mostly same as for regression - more is always better.&lt;br /&gt;
* Model assessment strategies: Chi-square test, Comparative Fit Index, Root Mean Square Error, Tucker Lewis Index, Goodness of Fit Index, AIC, and BIC.&amp;gt;&lt;br /&gt;
* Choice for number of Indicator variables: depends on pilot data analyses, a priori concerns, fewer is better.&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM_Ex1|Hands-on Example 1 (School Kids Mental Abilities)]]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM_Ex2|Hands-on Example 2 (Parkinson’s Disease data)]]===&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM_sem_vs_cfa| Differences and Similarities between '''sem'''() and '''cfa'''() ]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Next Section: Growth Curve Modeling]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis_LOS&amp;diff=16251</id>
		<title>SMHS TimeSeriesAnalysis LOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis_LOS&amp;diff=16251"/>
		<updated>2016-05-24T14:37:07Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_TimeSeriesAnalysis| SMHS: Time-series Analysis]] - Applications ==&lt;br /&gt;
&lt;br /&gt;
===Time series regression studies in environmental epidemiology (London Ozone Study 2002-2006)===&lt;br /&gt;
A time series regression analysis of a London ozone dataset including daily observations from 1 January 2002 to 31 December 2006. Each day has records of (mean) '''ozone''' levels that day, and the total number of '''deaths''' that occurred in the city. &lt;br /&gt;
&lt;br /&gt;
====Questions====&lt;br /&gt;
*Is there an association between day-to-day variation in ozone levels and daily risk of death?&lt;br /&gt;
*Is ozone exposure associated with the outcome is death or other confounders - temperature and relative humidity?&lt;br /&gt;
&lt;br /&gt;
'''Reference:''' Bhaskaran K, Gasparrini A, Hajat S, Smeeth L, Armstrong B. Time series regression studies in environmental epidemiology. ''International Journal of Epidemiology''. 2013;42(4):1187-1195. doi:10.1093/ije/dyt092.&lt;br /&gt;
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3780998/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Load the Data&amp;lt;/b&amp;gt;&lt;br /&gt;
 library(foreign)&lt;br /&gt;
 &amp;amp;#35;07_LondonOzonPolutionData_2006_TS.csv&lt;br /&gt;
 &amp;amp;#35;data &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/720873/download?download_frd=1&amp;quot;)&lt;br /&gt;
 data &amp;lt;- read.dta(&amp;quot;https://umich.instructure.com/files/721042/download?download_frd=1&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;Set the Default Action for Missing Data to &amp;lt;b&amp;gt;na.exclude&amp;lt;/b&amp;gt;&lt;br /&gt;
 options(na.action=&amp;quot;na.exclude&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Exploratory Analyses&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;set the plotting parameters for the plot &lt;br /&gt;
&lt;br /&gt;
 oldpar &amp;lt;- par(no.readonly=TRUE)&lt;br /&gt;
 par(mex=0.8,mfrow=c(2,1))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;sub-plot for daily deaths, with vertical lines defining years&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,pch=&amp;quot;.&amp;quot;,main=&amp;quot;Daily deaths over time&amp;quot;,  &lt;br /&gt;
    ylab=&amp;quot;Daily number of deaths&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(v=data$\$$date[grep(&amp;quot;-01-01&amp;quot;,data$\$$date)],col=grey(0.6),lty=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;plot for ozone levels&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$ozone,pch=&amp;quot;.&amp;quot;,main=&amp;quot;Ozone levels over time&amp;quot;,&lt;br /&gt;
     ylab=&amp;quot;Daily mean ozone level(ug/m3)&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(v=data$\$$date[grep(&amp;quot;-01-01&amp;quot;,data$\$$date)],col=grey(0.6),lty=2)&lt;br /&gt;
 par(oldpar)&lt;br /&gt;
 layout(1)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;descriptive statistics&lt;br /&gt;
 &lt;br /&gt;
 summary(data)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;correlations&lt;br /&gt;
 &lt;br /&gt;
 cor(data[,2:4])&lt;br /&gt;
 &amp;amp;#35;scale exposure&lt;br /&gt;
 data$\$$ozone10 &amp;lt;- data$\$$ozone/10&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Modelling Seasonality and Long-Term Trend&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;option 1: time-stratified model &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;generate month and year&lt;br /&gt;
&lt;br /&gt;
 data$\$$month &amp;lt;- as.factor(months(data$\$$date,abbr=TRUE))&lt;br /&gt;
 data$\$$year &amp;lt;- as.factor(substr(data$\$$date,1,4))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;fit a Poisson model with a stratum for each month nested in year&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;(use of quasi-Poisson family for scaling the standard errors)&lt;br /&gt;
&lt;br /&gt;
 model1 &amp;lt;- glm(numdeaths ~ month/year,data,family=quasipoisson) &lt;br /&gt;
 summary(model1)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
 pred1 &amp;lt;- predict(model1,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 2a: Three alternative ways of modelling long-term patterns in the data (seasonality and trends)&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Time-stratified model (month strata)&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date, pred1,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Option 2: periodic functions model (fourier terms)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;use function harmonic, in package '''tsModel''' &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;tsModel&amp;quot;); library(tsModel)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;4 sine-cosine pairs representing different harmonics with period 1 year&lt;br /&gt;
&lt;br /&gt;
 data$\$$time &amp;lt;- seq(nrow(data))&lt;br /&gt;
 fourier &amp;lt;- harmonic(data$\$$time,nfreq=4,period=365.25)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;fit a Poisson model Fourier terms + linear term for trend &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;(use of quasi-Poisson family for scaling the standard errors)&lt;br /&gt;
&lt;br /&gt;
 model2 &amp;lt;- glm(numdeaths ~ fourier +time,data,family=quasipoisson) &lt;br /&gt;
 summary(model2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
&lt;br /&gt;
 pred2 &amp;lt;- predict(model2,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 2b&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date, data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Sine-cosine functions (Fourier terms)&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date, pred2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Option 3: Spline Model: Flexible Spline Functions&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;generate spline terms,  use function '''bs''' in package '''splines'''&lt;br /&gt;
 library(splines)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;A CUBIC B-SPLINE WITH 32 EQUALLY-SPACED KNOTS + 2 BOUNDARY KNOTS&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;Note: the 35 basis variables are set as df, with default knots placement. see '''?bs'''&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;other types of splines can be produced with the function ns. see '''?ns'''&lt;br /&gt;
 spl &amp;lt;- bs(data$\$$time,degree=3,df=35)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;Fit a Poisson Model Fourier Terms + Linear Term for Trend&lt;br /&gt;
&lt;br /&gt;
 model3 &amp;lt;- glm(numdeaths ~ spl,data,family=quasipoisson)&lt;br /&gt;
 summary(model3)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
&lt;br /&gt;
 pred3 &amp;lt;- predict(model3,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;FIGURE 2C&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6), &lt;br /&gt;
     main=&amp;quot;Flexible cubic spline model&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date,pred3,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Plot Response Residuals Over Time From Model 3&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;GENERATE RESIDUALS&lt;br /&gt;
 res3 &amp;lt;- residuals(model3,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&amp;amp;#35;Figure 3: Residual variation in daily deaths after ‘removing’ (i.e. modelling) season and long-term trend.&lt;br /&gt;
 plot(data$\$$date,res3,ylim=c(-50,150),pch=19,cex=0.4,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Residuals over time&amp;quot;,ylab=&amp;quot;Residuals (observed-fitted)&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(h=1,lty=2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Estimate ozone-mortality association - controlling for confounders&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compare the RR (and CI using '''ci.lin''' in package '''Epi''')&lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;Epi&amp;quot;); library(Epi)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;unadjusted model&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;- glm(numdeaths ~ ozone10,data,family=quasipoisson)&lt;br /&gt;
 summary(model4)&lt;br /&gt;
 (eff4 &amp;lt;- ci.lin(model4,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;control for seasonality (with spline as in model 3)&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- update(model4, .~. + spl)&lt;br /&gt;
 summary(model5)&lt;br /&gt;
 (eff5 &amp;lt;- ci.lin(model5,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;control for temperature - temperature modelled with categorical variables for deciles&lt;br /&gt;
 &lt;br /&gt;
 cutoffs &amp;lt;- quantile(data$\$$temperature,probs=0:10/10)&lt;br /&gt;
 tempdecile &amp;lt;- cut(data$\$$temperature,breaks=cutoffs,include.lowest=TRUE)&lt;br /&gt;
 model6 &amp;lt;- update(model5,.~.+tempdecile)&lt;br /&gt;
 summary(model6)&lt;br /&gt;
 (eff6 &amp;lt;- ci.lin(model6,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Build a summary table with effect as percent increase&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 tabeff &amp;lt;- rbind(eff4,eff5,eff6)[,5:7]&lt;br /&gt;
 tabeff &amp;lt;- (tabeff-1)*100&lt;br /&gt;
 dimnames(tabeff) &amp;lt;- list(c(&amp;quot;Unadjusted&amp;quot;,&amp;quot;Plus season/trend&amp;quot;,&amp;quot;Plus temperature&amp;quot;), c(&amp;quot;RR&amp;quot;,&amp;quot;ci.low&amp;quot;,&amp;quot;ci.hi&amp;quot;))&lt;br /&gt;
 round(tabeff,2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;explore the lagged (delayed) effects&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;SINGLE-LAG MODELS&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;prepare the table with estimates&lt;br /&gt;
&lt;br /&gt;
 tablag &amp;lt;- matrix(NA,7+1,3,dimnames=list(paste(&amp;quot;Lag&amp;quot;,0:7),  c(&amp;quot;RR&amp;quot;,&amp;quot;ci.low&amp;quot;,&amp;quot;ci.hi&amp;quot;)))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;iterate&lt;br /&gt;
&lt;br /&gt;
 for(i in 0:7) {&lt;br /&gt;
     &amp;amp;#35;lag ozone and temperature variables&lt;br /&gt;
     ozone10lag &amp;lt;- Lag(data$\$$ozone10,i)&lt;br /&gt;
     tempdecilelag &amp;lt;- cut(Lag(data$\$$temperature,i),breaks=cutoffs,   include.lowest=TRUE)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;define the transformation for temperature&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;lag same as above, but with strata terms instead than linear&lt;br /&gt;
 &lt;br /&gt;
     mod &amp;lt;- glm(numdeaths ~ ozone10lag + tempdecilelag + spl,data,   family=quasipoisson)&lt;br /&gt;
     tablag[i+1,] &amp;lt;- ci.lin(mod,subset=&amp;quot;ozone10lag&amp;quot;,Exp=T)[5:7]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
 tablag&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 4A: Modelling lagged (delayed) associations between ozone exposure and survival/death outcome.&lt;br /&gt;
&lt;br /&gt;
 plot(0:7,0:7,type=&amp;quot;n&amp;quot;,ylim=c(0.99,1.03),main=&amp;quot;Lag terms modelled one at a time&amp;quot;, xlab=&amp;quot;Lag (days)&amp;quot;,&lt;br /&gt;
     ylab=&amp;quot;RR and 95%CI per 10ug/m3 ozone increase&amp;quot;)&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 abline(h=1)&lt;br /&gt;
 arrows(0:7,tablag[,2],0:7,tablag[,3],length=0.05,angle=90,code=3)&lt;br /&gt;
 points(0:7,tablag[,1],pch=19)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Checking&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;generate deviance residuals from unconstrained distributed lag model&lt;br /&gt;
&lt;br /&gt;
 res6 &amp;lt;- residuals(model6,type=&amp;quot;deviance&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A1: Plot of deviance residuals over time (London data)&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,res6,ylim=c(-5,10),pch=19,cex=0.7,col=grey(0.6),&lt;br /&gt;
      main=&amp;quot;Residuals over time&amp;quot;,ylab=&amp;quot;Deviance residuals&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(h=0,lty=2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A2a: Residual plot for Model6: the residuals relate to the unconstrained distributed lag model with ozone&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;(lag days 0 to 7 inclusive), adjusted for temperature at the same lags. The spike in the plot of residuals relate to&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;the 2003 European heat wave, and indicate that the current model does not explain the data over this period well.&lt;br /&gt;
&lt;br /&gt;
 pacf(res6,na.action=na.omit,main=&amp;quot;From original model&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Include the 1-Day Lagged Residual in the Model&lt;br /&gt;
&lt;br /&gt;
 model9 &amp;lt;- update(model6,.~.+Lag(res6,1))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A2b: residuals related to the unconstrained distributed lag model with ozone (lag days 0 to 7 inclusive),&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;adjusted for temperature at the same lags&lt;br /&gt;
&lt;br /&gt;
 pacf(residuals(model9,type=&amp;quot;deviance&amp;quot;),na.action=na.omit,   &lt;br /&gt;
     main=&amp;quot;From model adjusted for residual autocorrelation&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
====Irish Longitudinal Study on Ageing Example====&lt;br /&gt;
&lt;br /&gt;
The Irish Longitudinal Study on Ageing (TILDA), 2009-2011 &amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/34315&amp;lt;BR&amp;gt;&lt;br /&gt;
Kenny, Rose Anne. The Irish Longitudinal Study on Ageing (TILDA),&amp;lt;BR&amp;gt;&lt;br /&gt;
2009-2011. ICPSR34315-v1. Ann Arbor, MI: Inter-university Consortium&amp;lt;BR&amp;gt;&lt;br /&gt;
Bibliographic Citation: for Political and Social Research [distributor], 2014-07-16.&amp;lt;BR&amp;gt;&lt;br /&gt;
http://doi.org/10.3886/ICPSR34315.v1&lt;br /&gt;
&lt;br /&gt;
The Irish Longitudinal Study on Ageing (TILDA) is a major inter-institutional initiative led by Trinity College, Dublin, to improve in the quantity and quality of data, research and information related to aging in Ireland. Eligible respondents for this study include individuals aged ≥ 50 and their spouses or partners of any age. Annual interviews on a two yearly basis (N=8,504 people) in Ireland, collecting detailed information on all aspects of their lives, including the economic (pensions, employment, living standards), health (physical, mental, service needs and usage) and social aspects (contact with friends and kin, formal and informal care, social participation). Survey interviews, physical, and biological data are collected along with demographic variables (e.g., age, sex, marital status, household composition, education, and employment), and activities of daily living (ADL), aging, childhood, depression (psychology), education, employment, exercise, eyesight, families, family life, etc.&lt;br /&gt;
&lt;br /&gt;
 # download the RDA data object (ICPSR_34315.zip)&lt;br /&gt;
 # load in the data into RStudio&lt;br /&gt;
 dataURL &amp;lt;- &amp;quot;https://umich.instructure.com/files/703606/download?download_frd=1&amp;quot;&lt;br /&gt;
 load(url(dataURL))&lt;br /&gt;
 head(da34315.0001); data_colnames &amp;lt;- colnames(da34315.0001)&lt;br /&gt;
 vars &amp;lt;- da34315.0001&lt;br /&gt;
&lt;br /&gt;
 vars; head(vars); summary(vars); data_colnames&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1]||”ID&amp;quot;||”HOUSEHOLD”&lt;br /&gt;
|-&lt;br /&gt;
|[3]|| &amp;quot;CLUSTER&amp;quot;||&amp;quot;STRATUM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[5]||”REGION”|| &amp;quot;CAPIWEIGHT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[7]|| &amp;quot;IN_SCQ&amp;quot;||&amp;quot;SCQ_WEIGHT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[9]|| &amp;quot;AGE&amp;quot;||&amp;quot;SEX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[11]|| &amp;quot;NML&amp;quot;||&amp;quot;CM003&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|...||||&lt;br /&gt;
|-&lt;br /&gt;
|[1673]||&amp;quot;HA_WEIGHT&amp;quot;||&amp;quot;IN_HA&amp;quot;&lt;br /&gt;
|-                                             &lt;br /&gt;
|[1675]|| &amp;quot;SR_HEIGHT_CENTIMETRES&amp;quot;||&amp;quot;HEIGHT&amp;quot;                          &lt;br /&gt;
|-&lt;br /&gt;
|[1677]|| &amp;quot;SR_WEIGHT_KILOGRAMMES&amp;quot;||&amp;quot;WEIGHT&amp;quot;                          &lt;br /&gt;
|-&lt;br /&gt;
|[1679]||&amp;quot;COGMMSE&amp;quot;||&amp;quot;FRGRIPSTRENGTHD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1681]||&amp;quot;FRGRIPSTRENGTHND&amp;quot;||&amp;quot;VISUALACUITYLEFT&amp;quot;   &lt;br /&gt;
|-&lt;br /&gt;
|[1683]||&amp;quot;VISUALACUITYRIGHT&amp;quot; ||&amp;quot;BPSEATEDSYSTOLIC1&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1685]||&amp;quot;BPSEATEDSYSTOLIC2&amp;quot;||&amp;quot;BPSEATEDDIASTOLIC1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1687]||&amp;quot;BPSEATEDDIASTOLIC2&amp;quot;||&amp;quot;BPSEATEDSYSTOLICMEAN&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1689]||&amp;quot;BPSEATEDDIASTOLICMEAN&amp;quot;||&amp;quot;BPHYPERTENSION&amp;quot;            &lt;br /&gt;
|-&lt;br /&gt;
|[1691]||&amp;quot;FRBMI&amp;quot;||&amp;quot;FRWAIST&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1693]||&amp;quot;FRHIP&amp;quot;||&amp;quot;FRWHR&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1695]||&amp;quot;WEARGLASSES&amp;quot;||&amp;quot;WOREGLASSESDURINGTEST&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1697]||&amp;quot;BLOODS_CHOL&amp;quot;||&amp;quot;BLOODS_HDL&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1699]||&amp;quot;BLOODS_LDL&amp;quot;||&amp;quot;BLOODS_TRIG&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1701]||&amp;quot;BLOODS_TIMEBETWEENLASTMEALANDASS&amp;quot;||&amp;quot;DELAY_HA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1703]||&amp;quot;PICMEMSCORE&amp;quot;||&amp;quot;PICRECALLSCORE&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1705]||&amp;quot;PICRECOGSCORE&amp;quot;||&amp;quot;VISREASONING&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1707]||&amp;quot;GRIPTEST1D&amp;quot;||&amp;quot;GRIPTEST2D&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1709]||&amp;quot;GRIPTEST1ND&amp;quot;||&amp;quot;GRIPTEST2ND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1711]||&amp;quot;GRIPTESTDOMINANT&amp;quot;||&amp;quot;GRIPTESTSITTING&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1713]||&amp;quot;TEMPERATURE&amp;quot;||&amp;quot;SCQSOCACT1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|...||||&lt;br /&gt;
|-&lt;br /&gt;
|[1981]||&amp;quot;SOCPROXCHLD4&amp;quot;||&amp;quot;SCRFLU&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1983]||&amp;quot;SCRCHOL&amp;quot;||&amp;quot;SCRPROSTATE&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1985]||&amp;quot;SCRBREASTLUMPS&amp;quot;||&amp;quot;SCRMAMMOGRAM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1987]||&amp;quot;BEHALC_FREQ_WEEK&amp;quot;||&amp;quot;BEHALC_DRINKSPERDAY&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1989]||&amp;quot;BEHALC_DRINKSPERWEEK&amp;quot;||&amp;quot;BEHALC_DOH_LIMIT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1991]||&amp;quot;BEHSMOKER&amp;quot;||&amp;quot;BEHCAGE&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # extract some data elements&lt;br /&gt;
 df1 &amp;lt;- data.frame(vars)&lt;br /&gt;
&lt;br /&gt;
 df_Irish_small &amp;lt;- df1[, c(&amp;quot;ID&amp;quot;,  &amp;quot;HOUSEHOLD&amp;quot;,  &amp;quot;AGE&amp;quot;, &amp;quot;SEX&amp;quot;  , &amp;quot;HA_WEIGHT&amp;quot;, &amp;quot;HEIGHT&amp;quot; ,                         &lt;br /&gt;
    &amp;quot;WEIGHT&amp;quot;, &amp;quot;COGMMSE&amp;quot;, &amp;quot;FRGRIPSTRENGTHD&amp;quot;, &amp;quot;VISUALACUITYLEFT&amp;quot;,       &lt;br /&gt;
    &amp;quot;VISUALACUITYRIGHT&amp;quot;,    &amp;quot;BPSEATEDSYSTOLIC1&amp;quot;,      &lt;br /&gt;
    &amp;quot;BPSEATEDSYSTOLIC2&amp;quot;,       &amp;quot;BPSEATEDDIASTOLIC1&amp;quot;,     &lt;br /&gt;
    &amp;quot;BPSEATEDDIASTOLIC2&amp;quot;,      &amp;quot;BPSEATEDSYSTOLICMEAN&amp;quot;,   &lt;br /&gt;
    &amp;quot;BPSEATEDDIASTOLICMEAN&amp;quot;,   &amp;quot;BPHYPERTENSION&amp;quot;,&lt;br /&gt;
    &amp;quot;WEARGLASSES&amp;quot;,   &amp;quot;WOREGLASSESDURINGTEST&amp;quot;,  &lt;br /&gt;
    &amp;quot;BLOODS_CHOL&amp;quot;,   &amp;quot;BLOODS_HDL&amp;quot;,    &lt;br /&gt;
    &amp;quot;BLOODS_LDL&amp;quot;,  &amp;quot;BLOODS_TRIG&amp;quot;,   &lt;br /&gt;
    &amp;quot;PICMEMSCORE&amp;quot;,   &amp;quot;PICRECALLSCORE&amp;quot;,&lt;br /&gt;
    &amp;quot;PICRECOGSCORE&amp;quot;, &amp;quot;VISREASONING&amp;quot;,  &lt;br /&gt;
    &amp;quot;TEMPERATURE&amp;quot;,  &amp;quot;SOCPROXCHLD4&amp;quot;,   &amp;quot;SCRFLU&amp;quot;, &amp;quot;SCRCHOL&amp;quot;,        &amp;quot;SCRPROSTATE&amp;quot;,   &lt;br /&gt;
    &amp;quot;SCRBREASTLUMPS&amp;quot;, &amp;quot;SCRMAMMOGRAM&amp;quot;,  &lt;br /&gt;
    &amp;quot;BEHALC_FREQ_WEEK&amp;quot;,        &amp;quot;BEHALC_DRINKSPERDAY&amp;quot;,    &lt;br /&gt;
    &amp;quot;BEHALC_DRINKSPERWEEK&amp;quot;,    &amp;quot;BEHALC_DOH_LIMIT&amp;quot;,       &lt;br /&gt;
    &amp;quot;BEHSMOKER&amp;quot;,      &amp;quot;BEHCAGE&amp;quot; )&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
 summary(df_Irish_small); head(df_Irish_small)&lt;br /&gt;
 write.table(df_Irish_small , &amp;quot;data.csv&amp;quot;, sep=&amp;quot;,&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===Applications===&lt;br /&gt;
&lt;br /&gt;
====Frailty associations with sustained attention measures&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
Multinomial logistic regression analyses were used to examine frailty as the outcome variable were performed to determine associations between the sustained attention measures and prefrailty or frailty. Binary logistic regression analyses determined significant associations between the sustained attention measures and the individual frailty components. The regression models included age and gender and were also extended to include additional measures of cognitive processing speed (cognitive RT from CRT), executive function (Delta CTT), number of chronic conditions, and number of medications. We also included the quadratic term age2 to allow for any potential nonlinear effects of age on frailty in each regression model. For the independent variables in the multinomial logistic regression models, relative risk (RR) ratios with 95% confidence intervals (CIs) were provided. For the independent variables in the binary logistic regression models, OR with 95% CI were provided.&lt;br /&gt;
&lt;br /&gt;
====Multivariable logistic regression examining the association between social relationships and depression, anxiety, and suicidal ideation&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; http://psychsocgerontology.oxfordjournals.org/content/early/2013/03/13/geronb.gbt009.full&lt;br /&gt;
* &amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; http://www.jad-journal.com/article/S0165-0327%2815%2900145-7/fulltext&lt;br /&gt;
&lt;br /&gt;
===Appendix===&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_TimeSeriesAnalysis| Previous Section on Time-series analysis]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.ucla.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=SMHS_TimeSeriesAnalysis_LOS}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis_LOS&amp;diff=16250</id>
		<title>SMHS TimeSeriesAnalysis LOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis_LOS&amp;diff=16250"/>
		<updated>2016-05-24T14:36:55Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Multivariable logistic regression examining the association between social relationships and depression, anxiety, and suicidal ideation6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_TimeSeriesAnalysis| SMHS: Time-series Analysis]] - Applications ==&lt;br /&gt;
&lt;br /&gt;
===Time series regression studies in environmental epidemiology (London Ozone Study 2002-2006)===&lt;br /&gt;
A time series regression analysis of a London ozone dataset including daily observations from 1 January 2002 to 31 December 2006. Each day has records of (mean) '''ozone''' levels that day, and the total number of '''deaths''' that occurred in the city. &lt;br /&gt;
&lt;br /&gt;
====Questions====&lt;br /&gt;
*Is there an association between day-to-day variation in ozone levels and daily risk of death?&lt;br /&gt;
*Is ozone exposure associated with the outcome is death or other confounders - temperature and relative humidity?&lt;br /&gt;
&lt;br /&gt;
'''Reference:''' Bhaskaran K, Gasparrini A, Hajat S, Smeeth L, Armstrong B. Time series regression studies in environmental epidemiology. ''International Journal of Epidemiology''. 2013;42(4):1187-1195. doi:10.1093/ije/dyt092.&lt;br /&gt;
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3780998/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Load the Data&amp;lt;/b&amp;gt;&lt;br /&gt;
 library(foreign)&lt;br /&gt;
 &amp;amp;#35;07_LondonOzonPolutionData_2006_TS.csv&lt;br /&gt;
 &amp;amp;#35;data &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/720873/download?download_frd=1&amp;quot;)&lt;br /&gt;
 data &amp;lt;- read.dta(&amp;quot;https://umich.instructure.com/files/721042/download?download_frd=1&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;Set the Default Action for Missing Data to &amp;lt;b&amp;gt;na.exclude&amp;lt;/b&amp;gt;&lt;br /&gt;
 options(na.action=&amp;quot;na.exclude&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Exploratory Analyses&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;set the plotting parameters for the plot &lt;br /&gt;
&lt;br /&gt;
 oldpar &amp;lt;- par(no.readonly=TRUE)&lt;br /&gt;
 par(mex=0.8,mfrow=c(2,1))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;sub-plot for daily deaths, with vertical lines defining years&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,pch=&amp;quot;.&amp;quot;,main=&amp;quot;Daily deaths over time&amp;quot;,  &lt;br /&gt;
    ylab=&amp;quot;Daily number of deaths&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(v=data$\$$date[grep(&amp;quot;-01-01&amp;quot;,data$\$$date)],col=grey(0.6),lty=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;plot for ozone levels&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$ozone,pch=&amp;quot;.&amp;quot;,main=&amp;quot;Ozone levels over time&amp;quot;,&lt;br /&gt;
     ylab=&amp;quot;Daily mean ozone level(ug/m3)&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(v=data$\$$date[grep(&amp;quot;-01-01&amp;quot;,data$\$$date)],col=grey(0.6),lty=2)&lt;br /&gt;
 par(oldpar)&lt;br /&gt;
 layout(1)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;descriptive statistics&lt;br /&gt;
 &lt;br /&gt;
 summary(data)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;correlations&lt;br /&gt;
 &lt;br /&gt;
 cor(data[,2:4])&lt;br /&gt;
 &amp;amp;#35;scale exposure&lt;br /&gt;
 data$\$$ozone10 &amp;lt;- data$\$$ozone/10&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Modelling Seasonality and Long-Term Trend&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;option 1: time-stratified model &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;generate month and year&lt;br /&gt;
&lt;br /&gt;
 data$\$$month &amp;lt;- as.factor(months(data$\$$date,abbr=TRUE))&lt;br /&gt;
 data$\$$year &amp;lt;- as.factor(substr(data$\$$date,1,4))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;fit a Poisson model with a stratum for each month nested in year&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;(use of quasi-Poisson family for scaling the standard errors)&lt;br /&gt;
&lt;br /&gt;
 model1 &amp;lt;- glm(numdeaths ~ month/year,data,family=quasipoisson) &lt;br /&gt;
 summary(model1)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
 pred1 &amp;lt;- predict(model1,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 2a: Three alternative ways of modelling long-term patterns in the data (seasonality and trends)&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Time-stratified model (month strata)&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date, pred1,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Option 2: periodic functions model (fourier terms)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;use function harmonic, in package '''tsModel''' &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;tsModel&amp;quot;); library(tsModel)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;4 sine-cosine pairs representing different harmonics with period 1 year&lt;br /&gt;
&lt;br /&gt;
 data$\$$time &amp;lt;- seq(nrow(data))&lt;br /&gt;
 fourier &amp;lt;- harmonic(data$\$$time,nfreq=4,period=365.25)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;fit a Poisson model Fourier terms + linear term for trend &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;(use of quasi-Poisson family for scaling the standard errors)&lt;br /&gt;
&lt;br /&gt;
 model2 &amp;lt;- glm(numdeaths ~ fourier +time,data,family=quasipoisson) &lt;br /&gt;
 summary(model2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
&lt;br /&gt;
 pred2 &amp;lt;- predict(model2,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 2b&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date, data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Sine-cosine functions (Fourier terms)&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date, pred2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Option 3: Spline Model: Flexible Spline Functions&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;generate spline terms,  use function '''bs''' in package '''splines'''&lt;br /&gt;
 library(splines)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;A CUBIC B-SPLINE WITH 32 EQUALLY-SPACED KNOTS + 2 BOUNDARY KNOTS&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;Note: the 35 basis variables are set as df, with default knots placement. see '''?bs'''&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;other types of splines can be produced with the function ns. see '''?ns'''&lt;br /&gt;
 spl &amp;lt;- bs(data$\$$time,degree=3,df=35)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;Fit a Poisson Model Fourier Terms + Linear Term for Trend&lt;br /&gt;
&lt;br /&gt;
 model3 &amp;lt;- glm(numdeaths ~ spl,data,family=quasipoisson)&lt;br /&gt;
 summary(model3)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compute predicted number of deaths from this model&lt;br /&gt;
&lt;br /&gt;
 pred3 &amp;lt;- predict(model3,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;FIGURE 2C&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,data$\$$numdeaths,ylim=c(100,300),pch=19,cex=0.2,col=grey(0.6), &lt;br /&gt;
     main=&amp;quot;Flexible cubic spline model&amp;quot;,ylab=&amp;quot;Daily number of deaths&amp;quot;, xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 lines(data$\$$date,pred3,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Plot Response Residuals Over Time From Model 3&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;GENERATE RESIDUALS&lt;br /&gt;
 res3 &amp;lt;- residuals(model3,type=&amp;quot;response&amp;quot;)&lt;br /&gt;
&amp;amp;#35;Figure 3: Residual variation in daily deaths after ‘removing’ (i.e. modelling) season and long-term trend.&lt;br /&gt;
 plot(data$\$$date,res3,ylim=c(-50,150),pch=19,cex=0.4,col=grey(0.6),&lt;br /&gt;
     main=&amp;quot;Residuals over time&amp;quot;,ylab=&amp;quot;Residuals (observed-fitted)&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(h=1,lty=2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Estimate ozone-mortality association - controlling for confounders&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;compare the RR (and CI using '''ci.lin''' in package '''Epi''')&lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;Epi&amp;quot;); library(Epi)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;unadjusted model&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;- glm(numdeaths ~ ozone10,data,family=quasipoisson)&lt;br /&gt;
 summary(model4)&lt;br /&gt;
 (eff4 &amp;lt;- ci.lin(model4,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;control for seasonality (with spline as in model 3)&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- update(model4, .~. + spl)&lt;br /&gt;
 summary(model5)&lt;br /&gt;
 (eff5 &amp;lt;- ci.lin(model5,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;control for temperature - temperature modelled with categorical variables for deciles&lt;br /&gt;
 &lt;br /&gt;
 cutoffs &amp;lt;- quantile(data$\$$temperature,probs=0:10/10)&lt;br /&gt;
 tempdecile &amp;lt;- cut(data$\$$temperature,breaks=cutoffs,include.lowest=TRUE)&lt;br /&gt;
 model6 &amp;lt;- update(model5,.~.+tempdecile)&lt;br /&gt;
 summary(model6)&lt;br /&gt;
 (eff6 &amp;lt;- ci.lin(model6,subset=&amp;quot;ozone10&amp;quot;,Exp=T))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Build a summary table with effect as percent increase&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 tabeff &amp;lt;- rbind(eff4,eff5,eff6)[,5:7]&lt;br /&gt;
 tabeff &amp;lt;- (tabeff-1)*100&lt;br /&gt;
 dimnames(tabeff) &amp;lt;- list(c(&amp;quot;Unadjusted&amp;quot;,&amp;quot;Plus season/trend&amp;quot;,&amp;quot;Plus temperature&amp;quot;), c(&amp;quot;RR&amp;quot;,&amp;quot;ci.low&amp;quot;,&amp;quot;ci.hi&amp;quot;))&lt;br /&gt;
 round(tabeff,2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;explore the lagged (delayed) effects&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;SINGLE-LAG MODELS&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;prepare the table with estimates&lt;br /&gt;
&lt;br /&gt;
 tablag &amp;lt;- matrix(NA,7+1,3,dimnames=list(paste(&amp;quot;Lag&amp;quot;,0:7),  c(&amp;quot;RR&amp;quot;,&amp;quot;ci.low&amp;quot;,&amp;quot;ci.hi&amp;quot;)))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;iterate&lt;br /&gt;
&lt;br /&gt;
 for(i in 0:7) {&lt;br /&gt;
     &amp;amp;#35;lag ozone and temperature variables&lt;br /&gt;
     ozone10lag &amp;lt;- Lag(data$\$$ozone10,i)&lt;br /&gt;
     tempdecilelag &amp;lt;- cut(Lag(data$\$$temperature,i),breaks=cutoffs,   include.lowest=TRUE)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;define the transformation for temperature&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;lag same as above, but with strata terms instead than linear&lt;br /&gt;
 &lt;br /&gt;
     mod &amp;lt;- glm(numdeaths ~ ozone10lag + tempdecilelag + spl,data,   family=quasipoisson)&lt;br /&gt;
     tablag[i+1,] &amp;lt;- ci.lin(mod,subset=&amp;quot;ozone10lag&amp;quot;,Exp=T)[5:7]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
 tablag&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure 4A: Modelling lagged (delayed) associations between ozone exposure and survival/death outcome.&lt;br /&gt;
&lt;br /&gt;
 plot(0:7,0:7,type=&amp;quot;n&amp;quot;,ylim=c(0.99,1.03),main=&amp;quot;Lag terms modelled one at a time&amp;quot;, xlab=&amp;quot;Lag (days)&amp;quot;,&lt;br /&gt;
     ylab=&amp;quot;RR and 95%CI per 10ug/m3 ozone increase&amp;quot;)&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 abline(h=1)&lt;br /&gt;
 arrows(0:7,tablag[,2],0:7,tablag[,3],length=0.05,angle=90,code=3)&lt;br /&gt;
 points(0:7,tablag[,1],pch=19)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Checking&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;generate deviance residuals from unconstrained distributed lag model&lt;br /&gt;
&lt;br /&gt;
 res6 &amp;lt;- residuals(model6,type=&amp;quot;deviance&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A1: Plot of deviance residuals over time (London data)&lt;br /&gt;
&lt;br /&gt;
 plot(data$\$$date,res6,ylim=c(-5,10),pch=19,cex=0.7,col=grey(0.6),&lt;br /&gt;
      main=&amp;quot;Residuals over time&amp;quot;,ylab=&amp;quot;Deviance residuals&amp;quot;,xlab=&amp;quot;Date&amp;quot;)&lt;br /&gt;
 abline(h=0,lty=2,lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A2a: Residual plot for Model6: the residuals relate to the unconstrained distributed lag model with ozone&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;(lag days 0 to 7 inclusive), adjusted for temperature at the same lags. The spike in the plot of residuals relate to&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;the 2003 European heat wave, and indicate that the current model does not explain the data over this period well.&lt;br /&gt;
&lt;br /&gt;
 pacf(res6,na.action=na.omit,main=&amp;quot;From original model&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Include the 1-Day Lagged Residual in the Model&lt;br /&gt;
&lt;br /&gt;
 model9 &amp;lt;- update(model6,.~.+Lag(res6,1))&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Figure A2b: residuals related to the unconstrained distributed lag model with ozone (lag days 0 to 7 inclusive),&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;adjusted for temperature at the same lags&lt;br /&gt;
&lt;br /&gt;
 pacf(residuals(model9,type=&amp;quot;deviance&amp;quot;),na.action=na.omit,   &lt;br /&gt;
     main=&amp;quot;From model adjusted for residual autocorrelation&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
====Irish Longitudinal Study on Ageing Example====&lt;br /&gt;
&lt;br /&gt;
The Irish Longitudinal Study on Ageing (TILDA), 2009-2011 &amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/34315&amp;lt;BR&amp;gt;&lt;br /&gt;
Kenny, Rose Anne. The Irish Longitudinal Study on Ageing (TILDA),&amp;lt;BR&amp;gt;&lt;br /&gt;
2009-2011. ICPSR34315-v1. Ann Arbor, MI: Inter-university Consortium&amp;lt;BR&amp;gt;&lt;br /&gt;
Bibliographic Citation: for Political and Social Research [distributor], 2014-07-16.&amp;lt;BR&amp;gt;&lt;br /&gt;
http://doi.org/10.3886/ICPSR34315.v1&lt;br /&gt;
&lt;br /&gt;
The Irish Longitudinal Study on Ageing (TILDA) is a major inter-institutional initiative led by Trinity College, Dublin, to improve in the quantity and quality of data, research and information related to aging in Ireland. Eligible respondents for this study include individuals aged ≥ 50 and their spouses or partners of any age. Annual interviews on a two yearly basis (N=8,504 people) in Ireland, collecting detailed information on all aspects of their lives, including the economic (pensions, employment, living standards), health (physical, mental, service needs and usage) and social aspects (contact with friends and kin, formal and informal care, social participation). Survey interviews, physical, and biological data are collected along with demographic variables (e.g., age, sex, marital status, household composition, education, and employment), and activities of daily living (ADL), aging, childhood, depression (psychology), education, employment, exercise, eyesight, families, family life, etc.&lt;br /&gt;
&lt;br /&gt;
 # download the RDA data object (ICPSR_34315.zip)&lt;br /&gt;
 # load in the data into RStudio&lt;br /&gt;
 dataURL &amp;lt;- &amp;quot;https://umich.instructure.com/files/703606/download?download_frd=1&amp;quot;&lt;br /&gt;
 load(url(dataURL))&lt;br /&gt;
 head(da34315.0001); data_colnames &amp;lt;- colnames(da34315.0001)&lt;br /&gt;
 vars &amp;lt;- da34315.0001&lt;br /&gt;
&lt;br /&gt;
 vars; head(vars); summary(vars); data_colnames&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1]||”ID&amp;quot;||”HOUSEHOLD”&lt;br /&gt;
|-&lt;br /&gt;
|[3]|| &amp;quot;CLUSTER&amp;quot;||&amp;quot;STRATUM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[5]||”REGION”|| &amp;quot;CAPIWEIGHT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[7]|| &amp;quot;IN_SCQ&amp;quot;||&amp;quot;SCQ_WEIGHT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[9]|| &amp;quot;AGE&amp;quot;||&amp;quot;SEX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[11]|| &amp;quot;NML&amp;quot;||&amp;quot;CM003&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|...||||&lt;br /&gt;
|-&lt;br /&gt;
|[1673]||&amp;quot;HA_WEIGHT&amp;quot;||&amp;quot;IN_HA&amp;quot;&lt;br /&gt;
|-                                             &lt;br /&gt;
|[1675]|| &amp;quot;SR_HEIGHT_CENTIMETRES&amp;quot;||&amp;quot;HEIGHT&amp;quot;                          &lt;br /&gt;
|-&lt;br /&gt;
|[1677]|| &amp;quot;SR_WEIGHT_KILOGRAMMES&amp;quot;||&amp;quot;WEIGHT&amp;quot;                          &lt;br /&gt;
|-&lt;br /&gt;
|[1679]||&amp;quot;COGMMSE&amp;quot;||&amp;quot;FRGRIPSTRENGTHD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1681]||&amp;quot;FRGRIPSTRENGTHND&amp;quot;||&amp;quot;VISUALACUITYLEFT&amp;quot;   &lt;br /&gt;
|-&lt;br /&gt;
|[1683]||&amp;quot;VISUALACUITYRIGHT&amp;quot; ||&amp;quot;BPSEATEDSYSTOLIC1&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1685]||&amp;quot;BPSEATEDSYSTOLIC2&amp;quot;||&amp;quot;BPSEATEDDIASTOLIC1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1687]||&amp;quot;BPSEATEDDIASTOLIC2&amp;quot;||&amp;quot;BPSEATEDSYSTOLICMEAN&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1689]||&amp;quot;BPSEATEDDIASTOLICMEAN&amp;quot;||&amp;quot;BPHYPERTENSION&amp;quot;            &lt;br /&gt;
|-&lt;br /&gt;
|[1691]||&amp;quot;FRBMI&amp;quot;||&amp;quot;FRWAIST&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1693]||&amp;quot;FRHIP&amp;quot;||&amp;quot;FRWHR&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1695]||&amp;quot;WEARGLASSES&amp;quot;||&amp;quot;WOREGLASSESDURINGTEST&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1697]||&amp;quot;BLOODS_CHOL&amp;quot;||&amp;quot;BLOODS_HDL&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1699]||&amp;quot;BLOODS_LDL&amp;quot;||&amp;quot;BLOODS_TRIG&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1701]||&amp;quot;BLOODS_TIMEBETWEENLASTMEALANDASS&amp;quot;||&amp;quot;DELAY_HA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1703]||&amp;quot;PICMEMSCORE&amp;quot;||&amp;quot;PICRECALLSCORE&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1705]||&amp;quot;PICRECOGSCORE&amp;quot;||&amp;quot;VISREASONING&amp;quot;  &lt;br /&gt;
|-&lt;br /&gt;
|[1707]||&amp;quot;GRIPTEST1D&amp;quot;||&amp;quot;GRIPTEST2D&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1709]||&amp;quot;GRIPTEST1ND&amp;quot;||&amp;quot;GRIPTEST2ND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1711]||&amp;quot;GRIPTESTDOMINANT&amp;quot;||&amp;quot;GRIPTESTSITTING&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|[1713]||&amp;quot;TEMPERATURE&amp;quot;||&amp;quot;SCQSOCACT1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|...||||&lt;br /&gt;
|-&lt;br /&gt;
|[1981]||&amp;quot;SOCPROXCHLD4&amp;quot;||&amp;quot;SCRFLU&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1983]||&amp;quot;SCRCHOL&amp;quot;||&amp;quot;SCRPROSTATE&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1985]||&amp;quot;SCRBREASTLUMPS&amp;quot;||&amp;quot;SCRMAMMOGRAM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1987]||&amp;quot;BEHALC_FREQ_WEEK&amp;quot;||&amp;quot;BEHALC_DRINKSPERDAY&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1989]||&amp;quot;BEHALC_DRINKSPERWEEK&amp;quot;||&amp;quot;BEHALC_DOH_LIMIT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[1991]||&amp;quot;BEHSMOKER&amp;quot;||&amp;quot;BEHCAGE&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # extract some data elements&lt;br /&gt;
 df1 &amp;lt;- data.frame(vars)&lt;br /&gt;
&lt;br /&gt;
 df_Irish_small &amp;lt;- df1[, c(&amp;quot;ID&amp;quot;,  &amp;quot;HOUSEHOLD&amp;quot;,  &amp;quot;AGE&amp;quot;, &amp;quot;SEX&amp;quot;  , &amp;quot;HA_WEIGHT&amp;quot;, &amp;quot;HEIGHT&amp;quot; ,                         &lt;br /&gt;
    &amp;quot;WEIGHT&amp;quot;, &amp;quot;COGMMSE&amp;quot;, &amp;quot;FRGRIPSTRENGTHD&amp;quot;, &amp;quot;VISUALACUITYLEFT&amp;quot;,       &lt;br /&gt;
    &amp;quot;VISUALACUITYRIGHT&amp;quot;,    &amp;quot;BPSEATEDSYSTOLIC1&amp;quot;,      &lt;br /&gt;
    &amp;quot;BPSEATEDSYSTOLIC2&amp;quot;,       &amp;quot;BPSEATEDDIASTOLIC1&amp;quot;,     &lt;br /&gt;
    &amp;quot;BPSEATEDDIASTOLIC2&amp;quot;,      &amp;quot;BPSEATEDSYSTOLICMEAN&amp;quot;,   &lt;br /&gt;
    &amp;quot;BPSEATEDDIASTOLICMEAN&amp;quot;,   &amp;quot;BPHYPERTENSION&amp;quot;,&lt;br /&gt;
    &amp;quot;WEARGLASSES&amp;quot;,   &amp;quot;WOREGLASSESDURINGTEST&amp;quot;,  &lt;br /&gt;
    &amp;quot;BLOODS_CHOL&amp;quot;,   &amp;quot;BLOODS_HDL&amp;quot;,    &lt;br /&gt;
    &amp;quot;BLOODS_LDL&amp;quot;,  &amp;quot;BLOODS_TRIG&amp;quot;,   &lt;br /&gt;
    &amp;quot;PICMEMSCORE&amp;quot;,   &amp;quot;PICRECALLSCORE&amp;quot;,&lt;br /&gt;
    &amp;quot;PICRECOGSCORE&amp;quot;, &amp;quot;VISREASONING&amp;quot;,  &lt;br /&gt;
    &amp;quot;TEMPERATURE&amp;quot;,  &amp;quot;SOCPROXCHLD4&amp;quot;,   &amp;quot;SCRFLU&amp;quot;, &amp;quot;SCRCHOL&amp;quot;,        &amp;quot;SCRPROSTATE&amp;quot;,   &lt;br /&gt;
    &amp;quot;SCRBREASTLUMPS&amp;quot;, &amp;quot;SCRMAMMOGRAM&amp;quot;,  &lt;br /&gt;
    &amp;quot;BEHALC_FREQ_WEEK&amp;quot;,        &amp;quot;BEHALC_DRINKSPERDAY&amp;quot;,    &lt;br /&gt;
    &amp;quot;BEHALC_DRINKSPERWEEK&amp;quot;,    &amp;quot;BEHALC_DOH_LIMIT&amp;quot;,       &lt;br /&gt;
    &amp;quot;BEHSMOKER&amp;quot;,      &amp;quot;BEHCAGE&amp;quot; )&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
 summary(df_Irish_small); head(df_Irish_small)&lt;br /&gt;
 write.table(df_Irish_small , &amp;quot;data.csv&amp;quot;, sep=&amp;quot;,&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===Applications===&lt;br /&gt;
&lt;br /&gt;
====Frailty associations with sustained attention measures&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
Multinomial logistic regression analyses were used to examine frailty as the outcome variable were performed to determine associations between the sustained attention measures and prefrailty or frailty. Binary logistic regression analyses determined significant associations between the sustained attention measures and the individual frailty components. The regression models included age and gender and were also extended to include additional measures of cognitive processing speed (cognitive RT from CRT), executive function (Delta CTT), number of chronic conditions, and number of medications. We also included the quadratic term age2 to allow for any potential nonlinear effects of age on frailty in each regression model. For the independent variables in the multinomial logistic regression models, relative risk (RR) ratios with 95% confidence intervals (CIs) were provided. For the independent variables in the binary logistic regression models, OR with 95% CI were provided.&lt;br /&gt;
&lt;br /&gt;
====Multivariable logistic regression examining the association between social relationships and depression, anxiety, and suicidal ideation&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;http://psychsocgerontology.oxfordjournals.org/content/early/2013/03/13/geronb.gbt009.full&lt;br /&gt;
* &amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;http://www.jad-journal.com/article/S0165-0327%2815%2900145-7/fulltext&lt;br /&gt;
&lt;br /&gt;
===Appendix===&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_TimeSeriesAnalysis| Previous Section on Time-series analysis]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.ucla.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=SMHS_TimeSeriesAnalysis_LOS}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis&amp;diff=16249</id>
		<title>SMHS TimeSeriesAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_TimeSeriesAnalysis&amp;diff=16249"/>
		<updated>2016-05-24T14:29:03Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS| Scientific Methods for Health Sciences]] - Time Series Analysis ==&lt;br /&gt;
&lt;br /&gt;
===Questions===&lt;br /&gt;
* Why are trends, patterns or predictions from models/data important?&lt;br /&gt;
* How to detect, model and utilize trends in longitudinal data?&lt;br /&gt;
&lt;br /&gt;
Time series analysis represents a class of statistical methods applicable for series data aiming to extract meaningful information, trend and characterization of the process using observed longitudinal data. These trends may be used for time series forecasting and for prediction of future values based on retrospective observations. Note that classical linear modeling (e.g., regression analysis) may also be employed for prediction &amp;amp; testing of associations using the values of one or more independent variables and their effect on the value of another variable. However, time series analysis allows dependencies (e.g., seasonal effects to be accounted for).&lt;br /&gt;
&lt;br /&gt;
===Time-series representation===&lt;br /&gt;
&lt;br /&gt;
There are 3 (distinct and complementary) types of &amp;lt;b&amp;gt;time series patterns&amp;lt;/b&amp;gt; that most time-series analyses are trying to identify, model and analyze. These include: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Trend&amp;lt;/b&amp;gt;: A trend is a long-term increase or decrease in the data that may be linear or non-linear, but is generally continuous (mostly monotonic). The trend may be referred to as direction.&lt;br /&gt;
* &amp;lt;b&amp;gt;Seasonal&amp;lt;/b&amp;gt;: A seasonal pattern is influence in the data, like seasonal factors (e.g., the quarter of the year, the month, or day of the week), which is always of a fixed known period.&lt;br /&gt;
* &amp;lt;b&amp;gt;Cyclic&amp;lt;/b&amp;gt;:  A cyclic pattern of fluctuations corresponds to rises and falls that are &amp;lt;i&amp;gt;not of fixed period.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries1.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, the following code shows several time series with different types of time series patterns.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;par&amp;lt;/b&amp;gt;(mfrow=c(3,2))&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;n &amp;lt;- 98&amp;lt;/b&amp;gt;&lt;br /&gt;
 X &amp;lt;- cbind(1:n)   # time points (annually)&lt;br /&gt;
 &amp;lt;u&amp;gt;Trend1&amp;lt;/u&amp;gt; &amp;lt;- LakeHuron+0.2*X  # series 1&lt;br /&gt;
 Trend2 &amp;lt;- LakeHuron-0.5*X  # series 2&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;u&amp;gt;Season1&amp;lt;/u&amp;gt; &amp;lt;- X; Season2 &amp;lt;- X;  # series 1 &amp;amp; 2&lt;br /&gt;
 for(i in 1:n) {&lt;br /&gt;
     &amp;lt;b&amp;gt;Season1&amp;lt;/b&amp;gt;[i] &amp;lt;- LakeHuron[i] + 5*(i%%4)&lt;br /&gt;
     &amp;lt;b&amp;gt;Season2&amp;lt;/b&amp;gt;[i] &amp;lt;- LakeHuron[i] -2*(i%%10)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;u&amp;gt;Cyclic1&amp;lt;/u&amp;gt; &amp;lt;- X; Cyclic2 &amp;lt;- X;  # series 1 &amp;amp; 2&lt;br /&gt;
 for(i in 1:n) {&lt;br /&gt;
 rand1 &amp;lt;- as.integer(runif(1, 1, 10))&lt;br /&gt;
     &amp;lt;b&amp;gt;Cyclic1&amp;lt;/b&amp;gt;[i] &amp;lt;- LakeHuron[i] + 3*(i%%rand1)&lt;br /&gt;
     &amp;lt;b&amp;gt;Cyclic2&amp;lt;/b&amp;gt;[i] &amp;lt;- LakeHuron[i] - 1*(i%%rand1)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, Trend1, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; Trend1&amp;quot;, main=&amp;quot;Trend1 (LakeHuron+0.2*X)&amp;quot;)&lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, Trend2, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; Trend2&amp;quot; , main=&amp;quot;Trend2 (LakeHuron-0.5*X)&amp;quot;)&lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, &amp;lt;b&amp;gt;Season1&amp;lt;/b&amp;gt;, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; &amp;lt;b&amp;gt;Season1&amp;lt;/b&amp;gt;&amp;quot;, main=&amp;quot; &amp;lt;b&amp;gt;Season1&amp;lt;/b&amp;gt;=Trend1 (LakeHuron+5(i%%4))&amp;quot;)&lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, &amp;lt;b&amp;gt;Season2&amp;lt;/b&amp;gt;, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; &amp;lt;b&amp;gt;Season2&amp;lt;/b&amp;gt;&amp;quot;, main=&amp;quot; &amp;lt;b&amp;gt;Season2&amp;lt;/b&amp;gt;=Trend1 (LakeHuron-2(i%%10))&amp;quot;)&lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, &amp;lt;b&amp;gt;Cyclic1&amp;lt;/b&amp;gt;, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; &amp;lt;b&amp;gt;Cyclic1&amp;lt;/b&amp;gt;&amp;quot;, main=&amp;quot; &amp;lt;b&amp;gt;Cyclic1&amp;lt;/b&amp;gt;=Trend1 (LakeHuron+3*(i%%rand1))&amp;quot;)&lt;br /&gt;
 &amp;lt;b&amp;gt;plot&amp;lt;/b&amp;gt;(X, &amp;lt;b&amp;gt;Cyclic2&amp;lt;/b&amp;gt;, xlab=&amp;quot;Year&amp;quot;,ylab=&amp;quot; &amp;lt;b&amp;gt;Cyclic2&amp;lt;/b&amp;gt;&amp;quot;, main=&amp;quot; &amp;lt;b&amp;gt;Cyclic2&amp;lt;/b&amp;gt; = Trend1 (LakeHuron-(i%%rand1))&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Note: If you get this run-time graphics error:&lt;br /&gt;
“&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Error in plot.new() : figure margins too large&amp;lt;/font&amp;gt;” &amp;lt;BR&amp;gt;&lt;br /&gt;
You need to make sure your graphics window is large enough or print to PDF:&lt;br /&gt;
&lt;br /&gt;
 pdf(&amp;quot;myplot.pdf&amp;quot;); plot(x); dev.off()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries2.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s look at the delta (Δ) changes - Lagged Differences, using &amp;lt;b&amp;gt;diff&amp;lt;/b&amp;gt;, which returns suitably lagged and iterated differences.&lt;br /&gt;
&lt;br /&gt;
 ## Default lag = 1&lt;br /&gt;
 &amp;lt;b&amp;gt;par&amp;lt;/b&amp;gt;(mfrow=c(1,1))&lt;br /&gt;
 hist(diff(Trend1), prob=T, col=&amp;quot;red&amp;quot;) # Plot histogram&lt;br /&gt;
 lines(density(diff(Trend1)),lwd=2)	# plot density estimate&lt;br /&gt;
 x&amp;lt;-seq(-4,4,length=100); y&amp;lt;-dnorm(x, mean(diff(Trend1)), sd(diff(Trend1)))&lt;br /&gt;
 lines(x,y,lwd=2,col=&amp;quot;blue&amp;quot;)	# plot MLE Normal Fit&lt;br /&gt;
&lt;br /&gt;
===Time series decomposition===&lt;br /&gt;
&lt;br /&gt;
Denote the time series $yt$ including the three components: a seasonal effect, a trend-cycle effect (containing both trend and cycle), and a remainder component (containing the residual variability in the time series).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Additive model&amp;lt;/b&amp;gt;: &lt;br /&gt;
$yt=St+Tt+Et,$ where $yt$ is the data at period $t, St$ is the seasonal component at period $t, Tt$ is the trend-cycle component at period $t$ and $Et$ is the remainder (error) component at period $t$. This &amp;lt;u&amp;gt;additive model&amp;lt;/u&amp;gt; is appropriate if the magnitude of the seasonal fluctuations or the variation around the trend-cycle does not vary with the level of the time series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Multiplicative model&amp;lt;/b&amp;gt;:  $yt=St×Tt×Et$. When the variation in the seasonal pattern, or the variation around the trend-cycle, are proportional to the level of the time series, then a multiplicative model is more appropriate. Note that when using a multiplicative model, we can transform the data to stabilize the variation in the series over time, and then use an additive model. For instance, a log transformation decomposes the multiplicative model from:&lt;br /&gt;
&lt;br /&gt;
$yt=St×Tt×Et$ &amp;lt;BR&amp;gt;&lt;br /&gt;
to the additive model: &amp;lt;BR&amp;gt;&lt;br /&gt;
$log(yt)=log(St)+log(Tt)+log(Et).$&lt;br /&gt;
&lt;br /&gt;
We can examine the Seasonal trends by decomposing the Time Series by &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;loess&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; (Local Polynomial Regression) Fitting into &amp;lt;b&amp;gt;S&amp;lt;/b&amp;gt;easonal, &amp;lt;b&amp;gt;T&amp;lt;/b&amp;gt;rend and irregular components using &amp;lt;b&amp;gt;L&amp;lt;/b&amp;gt;oess - Local Polynomial Regression Fitting (&amp;lt;b&amp;gt;stl&amp;lt;/b&amp;gt; function, in the default “stats” package):&lt;br /&gt;
&lt;br /&gt;
 # using Monthly Males Deaths from Lung Diseases in UK from bronchitis, emphysema and asthma, 1974–1979&lt;br /&gt;
 mdeaths  # is.ts(mdeaths)&lt;br /&gt;
 fit &amp;lt;- stl(mdeaths, s.window=5)&lt;br /&gt;
 plot(mdeaths, col=&amp;quot;gray&amp;quot;,   main=&amp;quot; Lung Diseases in UK &amp;quot;, ylab=&amp;quot; Lung Diseases Deaths&amp;quot;, xlab=&amp;quot;&amp;quot;)&lt;br /&gt;
 lines(fit\$\$$time.series[,2],col=&amp;quot;red&amp;quot;,ylab=&amp;quot;Trend&amp;quot;)&lt;br /&gt;
 plot(fit) # data, seasonal, trend, residuals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;“stl” function parameters&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|x||Univariate time series to be decomposed. This should be an object of class &amp;quot;ts&amp;quot; with a frequency greater than one.&lt;br /&gt;
|-&lt;br /&gt;
|s.window||either the character string &amp;quot;periodic&amp;quot; or the span (in lags) of the loess window for seasonal extraction, which should be odd and at least 7, according to Cleveland et al. This has no default.&lt;br /&gt;
|-&lt;br /&gt;
|s.degree||degree of locally-fitted polynomial in seasonal extraction. Should be zero or one.&lt;br /&gt;
|-&lt;br /&gt;
|t.window||the span (in lags) of the loess window for trend extraction, which should be odd. If NULL, the default, nextodd(ceiling((1.5*period) / (1-(1.5/s.window)))), is taken.&lt;br /&gt;
|-&lt;br /&gt;
|t.degree||degree of locally-fitted polynomial in trend extraction. Should be zero or one.&lt;br /&gt;
|-&lt;br /&gt;
|l.window||the span (in lags) of the loess window of the low-pass filter used for each subseries. Defaults to the smallest odd integer greater than or equal to frequency(x) which is recommended since it prevents competition between the trend and seasonal components. If not an odd integer its given value is increased to the next odd one.&lt;br /&gt;
|-&lt;br /&gt;
|l.degree||degree of locally-fitted polynomial for the subseries low-pass filter. Must be 0 or 1.&lt;br /&gt;
|-&lt;br /&gt;
|s.jump, t.jump, l.jump||integers at least one to increase speed of the respective smoother. Linear interpolation happens between every *.jump&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; value.&lt;br /&gt;
|-&lt;br /&gt;
|robust||logical indicating if robust fitting be used in the loess procedure.&lt;br /&gt;
|-&lt;br /&gt;
|inner||integer; the number of ‘inner’ (backfitting) iterations; usually very few (2) iterations suffice.&lt;br /&gt;
|-&lt;br /&gt;
|outer||integer; the number of ‘outer’ robustness iterations.&lt;br /&gt;
|-&lt;br /&gt;
|na.action||action on missing values.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries3.png|400px]] [[Image:SMHS_TimeSeries4.png|400px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;monthplot&amp;lt;/b&amp;gt;(fit$\$$time.series[,&amp;quot;seasonal&amp;quot;], main=&amp;quot;&amp;quot;, ylab=&amp;quot;Seasonal&amp;quot;, lwd=5)&lt;br /&gt;
 &amp;amp;#35;As the “fit &amp;lt;- stl(mdeaths, s.window=5)” object has 3 time-series components (seasonal; trend; remainder)&lt;br /&gt;
 &amp;amp;#35;we can alternatively plot them separately:&lt;br /&gt;
 &amp;amp;#35;monthplot(fit, choice = &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;seasonal&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;, cex.axis = 0.8)&lt;br /&gt;
 &amp;amp;#35;monthplot(fit, choice = &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;trend&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;, cex.axis = 0.8)&lt;br /&gt;
 &amp;amp;#35;monthplot(fit, choice = &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;remainder&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;, type = &amp;quot;h&amp;quot;, cex.axis = 1.2)    # histogramatic&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries5.png|400px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the seasonal plots and seasonal sub-series plots of the seasonal component illustrating the variation in the seasonal component over time (over the years).&lt;br /&gt;
&lt;br /&gt;
Using historical weather (average daily temperature at the University of Michigan, Ann Arbor):&lt;br /&gt;
[http://weather-warehouse.com/WeatherHistory/PastWeatherData_AnnArborUnivOfMi_AnnArbor_MI_January.html]&lt;br /&gt;
(See meta-data description and provenance online: [http://weather-warehouse.com/WxWfaqs.html]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Mean Temperature, (F), UMich, Ann Arbor (1900-2015)&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Year||Jan||Feb||Mar||Apr||May||Jun||Jul||Aug||Sep||Oct||Nov||Dec&lt;br /&gt;
|-&lt;br /&gt;
|2015||26.3||14.4||34.9||49||64.2||68||71.2||70.2||68.7||53.9||NR||NR&lt;br /&gt;
|-&lt;br /&gt;
|2014||24.4||19.4||29||48.9||60.7||69.7||68.8||70.8||63.2||52.1||35.4||33.3&lt;br /&gt;
|-&lt;br /&gt;
|2013||22.7||26.1||33.3||46||63.1||68.5||72.9||70.2||64.6||53.2||37.6||26.7&lt;br /&gt;
|-&lt;br /&gt;
|2012||22.4||32.8||50.7||49.2||65.2||71.4||78.9||72.2||63.9||51.7||39.6||34.8&lt;br /&gt;
|-&lt;br /&gt;
|...|| || || || || || || || || || || ||&lt;br /&gt;
|-&lt;br /&gt;
|...||17||15.3||31.4||47.3||57||69||76.6||72||63.4||52.2||35.2||23.7&lt;br /&gt;
|-&lt;br /&gt;
|1900||21.4||19.2||24.7||47.8||60.2||66.3||72||75.4||67.2||59||37.6||29.2&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # data: 07_UMich_AnnArbor_MI_TempPrecipitation_HistData_1900_2015.csv&lt;br /&gt;
 # more complete data is available here: 07_UMich_AnnArbor_MI_TempPrecipitation_HistData_1900_2015.xls umich_data &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/702739/download?download_frd=1&amp;quot;, header=TRUE)&lt;br /&gt;
 &lt;br /&gt;
 head(umich_data)&lt;br /&gt;
 &lt;br /&gt;
 # https://cran.r-project.org/web/packages/mgcv/mgcv.pdf &lt;br /&gt;
 # install.packages(&amp;quot;mgcv&amp;quot;);  require(mgcv) &lt;br /&gt;
 &lt;br /&gt;
 # install.packages(&amp;quot;gamair&amp;quot;); require(gamair)&lt;br /&gt;
 par(mfrow=c(1,1))&lt;br /&gt;
&lt;br /&gt;
The data are in wide format – convert to long format for plotting&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;reshape2&amp;quot;)&lt;br /&gt;
 long_data &amp;lt;- melt(umich_data, id.vars = c(&amp;quot;Year&amp;quot;), value.name = &amp;quot;temperature&amp;quot;)&lt;br /&gt;
 l.sort &amp;lt;- long_data[order(long_data$\$$Year),]&lt;br /&gt;
 head(l.sort); tail(l.sort)&lt;br /&gt;
 &lt;br /&gt;
 plot(l.sort$\$$temperature, data = l.sort, type = &amp;quot;l&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Fit the GAMM Model&amp;lt;/b&amp;gt; (Generalized Additive Mixed Model)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries6.png|400px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Fit a model with trend and seasonal components&amp;lt;/b&amp;gt; --- computation may be slow:&lt;br /&gt;
&lt;br /&gt;
 # define the parameters controlling the process of model-fitting/parameter-estimation&lt;br /&gt;
 ctrl &amp;lt;- list(niterEM = 0, msVerbose = TRUE, optimMethod=&amp;quot;L-BFGS-B&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # First try this model&lt;br /&gt;
 mod &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year)) + s(as.numeric(variable)), data = l.sort, method = &amp;quot;REML&amp;quot;,  correlation=corAR1(form = ~ 1|Year), knots=list(Variable = c(1, 12)), na.action=na.omit, control = ctrl)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;&amp;lt;u&amp;gt;Correlation&amp;lt;/u&amp;gt;: &amp;lt;b&amp;gt;corStruct&amp;lt;/b&amp;gt; object defineing correlation structures in &amp;lt;b&amp;gt;lme&amp;lt;/b&amp;gt;. Grouping factors in the formula for this&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;object are assumed to be nested within any random effect grouping factors, without the need to make this&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;explicit in the formula (somewhat different from the behavior of &amp;lt;b&amp;gt;lme&amp;lt;/b&amp;gt;).&amp;lt;BR&amp;gt; &lt;br /&gt;
&amp;amp;#35;This is similar to the GEE approach to correlation in the generalized case.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;&amp;lt;u&amp;gt;Knots&amp;lt;/u&amp;gt;: an optional list of user specified knot values to be used for basis construction --&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;different terms can use different numbers of knots, unless they share a covariate.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;#35;If you revise the model like this (below), it will compare nicely with 3 ARMA models (later)&amp;lt;BR&amp;gt;&lt;br /&gt;
 mod &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year), k=116) + s(as.numeric(variable), k=12), &lt;br /&gt;
    data = l.sort, correlation = corAR1(form = ~ 1|Year),  control = ctrl)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Summary of the fitted model:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(mod$\$$gam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Visualize the model trend (year) and seasonal terms (months)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 plot(mod$\$$gam, pages = 1)&lt;br /&gt;
 t &amp;lt;- cbind(1: 1392)	# define the time&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries7.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Plot the trend on the observed data -- with prediction:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 pred2 &amp;lt;- predict(mod$\$$gam, newdata = l.sort, type = &amp;quot;terms&amp;quot;)&lt;br /&gt;
 ptemp2 &amp;lt;- attr(pred2, &amp;quot;constant&amp;quot;) + &amp;lt;u&amp;gt;pred2[,1]&amp;lt;/u&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;# pred2[,1] = trend; 	pred2[,2] = seasonal effects&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;# mod$\$$gam&amp;lt;/b&amp;gt; is a GAM object containing information to use predict, summary and print methods, but not to use e.g. the anova method function to compare models&lt;br /&gt;
 plot(temperature ~ t, data = l.sort, type = &amp;quot;l&amp;quot;, xlab = &amp;quot;year&amp;quot;, ylab = expression(Temperature ~ (degree*F)))&lt;br /&gt;
 lines(ptemp2 ~ t, data = l.sort, col = &amp;quot;blue&amp;quot;, lwd = 2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries8.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Plot the seasonal model&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 pred &amp;lt;- predict(mod$\$$gam, newdata = l.sort, type = &amp;quot;terms&amp;quot;)&lt;br /&gt;
 ptemp &amp;lt;- attr(pred, &amp;quot;constant&amp;quot;) + &amp;lt;u&amp;gt;pred[,2]&amp;lt;/u&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 plot(l.sort$\$$temperature ~ t, data = l.sort, type = &amp;quot;l&amp;quot;,  xlab = &amp;quot;year&amp;quot;, ylab = expression(Temperature ~ (degree*F)))&lt;br /&gt;
 lines(ptemp, data = l.sort, col = &amp;quot;red&amp;quot;, lwd = 0.5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries9.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Zoom in first 100 temps (1:100)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 plot(l.sort$\$$temperature ~ t, data = l.sort, type = &amp;quot;l&amp;quot;,  &amp;lt;b&amp;gt;xlim=c(0, 120)&amp;lt;/b&amp;gt;, xlab = &amp;quot;year&amp;quot;, ylab = expression(Temperature ~ (degree*F))); lines(ptemp, data = l.sort, col = &amp;quot;red&amp;quot;, lwd = 0.5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries10.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To examine how much the estimated trend has changed over the 116 year period, we can use the data contained in &amp;lt;b&amp;gt;pred&amp;lt;/b&amp;gt; to compute the difference between the start (Jan 1900) and the end (Dec 2015) of the series in the &amp;lt;i&amp;gt;&amp;lt;u&amp;gt;trend&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; component only:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;tail(pred[,1], 1) - head(pred[,1], 1)&amp;lt;/b&amp;gt; # subtract the predicted temp [,1] in 1900 (head) from the temp in 2015 (tail)&lt;br /&gt;
 &lt;br /&gt;
 # names(attributes(pred)); str(pred)    # to see the components of the GAM prediction model object (pred)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Assess autocorrelation in residuals&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # head(umich_data); tail(umich_data)&lt;br /&gt;
 acf(resid(mod$\$$lme), lag.max = 36, main = &amp;quot;ACF&amp;quot;)&lt;br /&gt;
 # &amp;lt;b&amp;gt;acf&amp;lt;/b&amp;gt; = Auto-correlation and Cross-Covariance Function computes and plots the estimates of the autocovariance or autocorrelation function.&lt;br /&gt;
 # &amp;lt;b&amp;gt;pacf&amp;lt;/b&amp;gt; is the function used for the partial autocorrelations.&lt;br /&gt;
 # &amp;lt;b&amp;gt;ccf&amp;lt;/b&amp;gt; computes the cross-correlation or cross-covariance of two univariate series.&lt;br /&gt;
 pacf(resid(mod$\$$lme), lag.max = 36, main = &amp;quot;pACF&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Looking at the residuals of this model, using the (partial) autocorrelation function, we see that there may be some residual autocorrelation in the data that the trend term didn’t account for. The shapes of the ACF and the pACF suggest an &amp;lt;b&amp;gt;AR(p)&amp;lt;/b&amp;gt; model might be appropriate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Fit and compare 4 alternative autoregressive models (original mod, AR1, AR2 and AR3)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 ## AR(1)&lt;br /&gt;
 m1 &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year), k=116) + s(as.numeric(variable), k=12), &lt;br /&gt;
   data = l.sort, correlation = corARMA(form = ~ 1|Year, &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;p = 1&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;), control = ctrl)&lt;br /&gt;
&lt;br /&gt;
 ## AR(2)&lt;br /&gt;
 m2 &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year), k=116) + s(as.numeric(variable), k=12), &lt;br /&gt;
    data = l.sort, correlation = corARMA(form = ~ 1|Year, &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;p = 2&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;), control = ctrl)&lt;br /&gt;
&lt;br /&gt;
 ## AR(3)&lt;br /&gt;
 m3 &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year), k=116) + s(as.numeric(variable), k=12), &lt;br /&gt;
    data = l.sort, correlation = corARMA(form = ~ 1|Year, &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;p = 3&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;),  control = ctrl)&lt;br /&gt;
&lt;br /&gt;
Note that the correlation argument is specified by &amp;lt;b&amp;gt;corARMA(form = ~ 1|Year, p = x)&amp;lt;/b&amp;gt;, which fits an ARMA (auto-regressive moving average) process to the residuals, where &amp;lt;b&amp;gt;p&amp;lt;/b&amp;gt; indicates the order for the &amp;lt;b&amp;gt;AR&amp;lt;/b&amp;gt; part of the ARMA model, and &amp;lt;b&amp;gt;form = ~ 1|Year&amp;lt;/b&amp;gt; specifies that the ARMA is nested within each year. This may expedite the model fitting but may also hide potential residual variation from one year to another.&lt;br /&gt;
&lt;br /&gt;
Let’s compare the candidate models by using the generalized likelihood ratio test via the &amp;lt;b&amp;gt;anova()&amp;lt;/b&amp;gt; method for &amp;lt;b&amp;gt;lme&amp;lt;/b&amp;gt; objects; see our previous mixed effects modeling notes &amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; , &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. This model selection is justified as we work with nested models -- going from the AR(3) to the AR(1) by setting some of the AR coefficients to 0. The models also vary in terms of the coefficient estimates for the splines terms which may require fixing some values while choosing the AR structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;center&amp;gt;anova(mod$\$$lme, m1$\$$lme, m2$\$$lme, m3$\$$lme)&amp;lt;/center&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
|||Model||df||AIC||BIC||logLik||Test||L.Ratio||p-value&lt;br /&gt;
|-&lt;br /&gt;
|mod$\$$lme||1||7||7455.609||7492.228|| -3720.805|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|m1$\$$lme||2|| 7||7455.609||7492.228|| -3720.805|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|m2$\$$lme||3|| 8||7453.982||7495.832|| -3718.991||2 vs 3||3.627409||0.0568&lt;br /&gt;
|-&lt;br /&gt;
|m3$\$$lme||4|| 9||7455.966||7503.048|| -3718.983|| 3 vs 4||0.015687||0.9003&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interpretation &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AR(1) model (m1) does not provide a substantial increase in fit over the naive model (mod), and the AR(2) model (m2) only provides a marginal increase in the AR(1) model fit (m1). There is no improvement in moving from m2 to AR(3) model (m3).&lt;br /&gt;
&lt;br /&gt;
Let’s plot the AR(2) model (m2) to inspect how over-fitted the naive model with uncorrelated errors was in terms of the trend term, which shows similar smoothness compared to the initial (mod) model.&lt;br /&gt;
&lt;br /&gt;
 plot(m2$\$$gam, scale = 0)     #  plot(mod2$\$$gam, scale = 0)   # “scale=0” ensures optimal y-axis cropping of plot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries11.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Investigation of residual patterns&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 layout(matrix(1:2, ncol = 2))&lt;br /&gt;
 # original (mod) model&lt;br /&gt;
 acf(resid(mod$\$$lme), lag.max = 36, main = &amp;quot;ACF&amp;quot;); pacf(resid(mod$\$$lme), lag.max = 36, main = &amp;quot;pACF&amp;quot;)&lt;br /&gt;
 # pACF controls for the values of the time series at all shorter lags, which contrasts the ACF which does not control for other lags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries12.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This illustrates that there is some (month=1) Auto-correlation (ACF) and partial auto correlation in the residuals.&lt;br /&gt;
&lt;br /&gt;
 # ARM(2) model (m2)&lt;br /&gt;
 layout(matrix(1:2, ncol = 2))&lt;br /&gt;
 res &amp;lt;- resid(m2$\$$lme, type = &amp;quot;normalized&amp;quot;); &lt;br /&gt;
 acf(res, lag.max = 36, main = &amp;quot;ACF - AR(2) errors&amp;quot;); pacf(res, lag.max = 36, main = &amp;quot;pACF- AR(2) errors&amp;quot;)&lt;br /&gt;
 layout(1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries13.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No residual auto-correlation remains in &amp;lt;b&amp;gt;m2&amp;lt;/b&amp;gt;. The resulting fitted Generalized Additive Mixed Model (GAMM) object contains information about the trend and the contributions to the fitted values. The package '''mgcv'''&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; can spit the information using &amp;lt;b&amp;gt;predict()&amp;lt;/b&amp;gt; for each of the 4 models.&lt;br /&gt;
&lt;br /&gt;
 # require(mgcv); require(gamair)&lt;br /&gt;
 # m2 &amp;lt;- gamm(as.numeric(temperature) ~ s(as.numeric(Year), k=116) + s(as.numeric(variable), k=12), data = l.sort, correlation = corARMA(form = ~ 1|Year, &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;p = 2&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;), control = ctrl)&lt;br /&gt;
 &lt;br /&gt;
 pred2 &amp;lt;- predict(m2$\$$gam, newdata = l.sort, type = &amp;quot;terms&amp;quot;)&lt;br /&gt;
 pred_trend2 &amp;lt;- attr(pred2, &amp;quot;constant&amp;quot;) + &amp;lt;u&amp;gt;pred2[,1]&amp;lt;/u&amp;gt; &amp;lt;b&amp;gt;# trend&amp;lt;/b&amp;gt;&lt;br /&gt;
 pred_season2 &amp;lt;- attr(pred2, &amp;quot;constant&amp;quot;) + &amp;lt;u&amp;gt;pred2[,2]&amp;lt;/u&amp;gt; &amp;lt;b&amp;gt;# seasonal&amp;lt;/b&amp;gt; effects&lt;br /&gt;
 # plot(m2$\$$gam, scale = 0) # plot pure effects&lt;br /&gt;
 &lt;br /&gt;
 # Convert the 2 columns (Year and Month/variable) to R Date object&lt;br /&gt;
 # df_time &amp;lt;- as.Date(paste(as.numeric(l.sort$\$$Year), as.numeric(l.sort$\$$variable), &amp;quot;1&amp;quot;, sep=&amp;quot;-&amp;quot;)); df_time&lt;br /&gt;
 &lt;br /&gt;
 plot(x=df_time, y=l.sort$\$$temperature, data = l.sort, type = &amp;quot;l&amp;quot;,  xlim=c(as.Date(&amp;quot;1950-02-01&amp;quot;),as.Date(&amp;quot;1960-01-01&amp;quot;)), xlab = &amp;quot;year&amp;quot;, ylab = expression(Temperature ~ (degree*F)))&lt;br /&gt;
 lines(x=df_time, y=pred_trend2, data = l.sort, col = &amp;quot;red&amp;quot;, lwd = 2);&lt;br /&gt;
 lines(x=df_time, y=pred_season2, data = l.sort, col = &amp;quot;blue&amp;quot;, lwd = 2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries14.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Moving average smoothing===&lt;br /&gt;
&lt;br /&gt;
A moving average of order $m=2k+1$ can be expressed as:&lt;br /&gt;
$T_{t}=\frac{1}{2k+1}\sum_{j=-k}^{k}Y_{t+j}$ .&lt;br /&gt;
&lt;br /&gt;
The ''m''-MA represents an order m moving average, $T_t$, or the estimate of the trend-cycle at time ''t'', obtained by averaging values of the time series within ''k'' periods (left and right) of ''t''. This averaging process denoises the data (eliminates randomness in the data) and produces a smoother trend-cycle component.&lt;br /&gt;
&lt;br /&gt;
The 5-MA contains the values of $T_t$ with ''k''=2. To see what the trend-cycle estimate looks like, we plot it along with the original data&lt;br /&gt;
&lt;br /&gt;
 # print the moving average results (k=3 &amp;amp;#8596; m=7)&lt;br /&gt;
 # library(&amp;quot;forecast&amp;quot;)&lt;br /&gt;
 plot(l.sort$\$$temperature, data = l.sort, type = &amp;quot;l&amp;quot;, main=&amp;quot; UMich/AA Temp (1900-2015) &amp;quot;, ylab=&amp;quot; Temperature (F)&amp;quot;, xlab=&amp;quot;Year&amp;quot;)&lt;br /&gt;
 lines(ma(l.sort$\$$temperature, 12), col=&amp;quot;red&amp;quot;, lwd=5)&lt;br /&gt;
 lines(ma(l.sort$\$$temperature, 36), col=&amp;quot;blue&amp;quot;, lwd=3)&lt;br /&gt;
 &lt;br /&gt;
 legend(0, 80, 					# places a legend at the appropriate place &lt;br /&gt;
 c(&amp;quot;Raw&amp;quot;, &amp;quot;k=12 smoother&amp;quot;, &amp;quot;k=36 smoothest&amp;quot;), 	# puts text in the legend&lt;br /&gt;
 lty=c(1,1,1), 					# gives the legend appropriate symbols (lines)&lt;br /&gt;
 cex=1.0,  					# label sizes&lt;br /&gt;
 lwd=c(2.5,2.5), col=c(&amp;quot;black&amp;quot;, &amp;quot;red&amp;quot;, &amp;quot;blue&amp;quot;)) 	# gives the legend lines the correct color and width&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries15.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The blue trend (''k''=36) (3 yrs) is smoother than the original (raw) data (black) and the 1-yr average (''k''=12). It captures the main movement of the time series without all the minor fluctuations. We can’t estimate $T_t$ where ''t'' is close to the ends as there is not enough data there to compute the averages. The red trend (''k''=12) is smoother than the original (raw) data (black) but more jagged than the 3-yr average. The order of the moving average (''m'') determines the smoothness of the trend-cycle estimate. A larger order implies a smoother curve.&lt;br /&gt;
&lt;br /&gt;
===Simulation of a time-series analysis and prediction===&lt;br /&gt;
&lt;br /&gt;
 (1) Simulate a time series&lt;br /&gt;
 &lt;br /&gt;
 # the ts() function converts a numeric vector into an R time series object. &lt;br /&gt;
 # format is ts(vector, start=, end=, frequency=) where start and end are the times of the first and last observation&lt;br /&gt;
 # and frequency is the number of observations per unit time (1=annual, 4=quarterly, 12=monthly, etc.)&lt;br /&gt;
 Note that ''ling Rate'' = $\frac{1}{Frequency}$ &lt;br /&gt;
 &lt;br /&gt;
 # save a numeric vector containing 16-years (192 monthly) observations  &lt;br /&gt;
 # from Jan 2000 to Dec 2015 as a time series object&lt;br /&gt;
 sim_ts &amp;lt;- ts(as.integer(runif(192,0,10)), start=c(2000, 1), end=c(2015, 12), frequency=12)&lt;br /&gt;
 sim_ts&lt;br /&gt;
 &lt;br /&gt;
 # subset the time series (June 2014 to December 2015)&lt;br /&gt;
 sim_ts2 &amp;lt;- window(sim_ts, start=c(2014, 6), end=c(2015, 12))&lt;br /&gt;
 sim_ts2&lt;br /&gt;
 &lt;br /&gt;
 # plot series &lt;br /&gt;
 plot(sim_ts)&lt;br /&gt;
 lines(sim_ts2, col=&amp;quot;blue&amp;quot;, lwd=3)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries16.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Seasonal Decomposition====&lt;br /&gt;
&lt;br /&gt;
*The additive and seasonal trends, and irregular components, of time-series may be decomposed using the stl() function. Series with multiplicative effects can by transformed into series with additive effects through a log transformation (i.e., '''ln_sim_ts &amp;lt;- log(sim_ts)).&lt;br /&gt;
 # Seasonal decomposition&lt;br /&gt;
 fit_stl &amp;lt;- stl(sim_ts, s.window=&amp;quot;period&amp;quot;)   '''# Seasonal Decomposition of Time Series by Loess'''&lt;br /&gt;
 plot(fit_stl)&lt;br /&gt;
 &lt;br /&gt;
 # inspect the distribution of the residuals&lt;br /&gt;
 hist(fit_stl$\$$time.series[,3]);  #   this contains the residuals: fit_stl$\$$time.series  [,&amp;quot;remainder&amp;quot;], or  seasonal, trend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries17.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # additional plots &lt;br /&gt;
 monthplot(sim_ts)	# plots the seasonal subseries of a time series. For each season, a time series is plotted.&lt;br /&gt;
 &lt;br /&gt;
 # library(forecast)&lt;br /&gt;
 seasonplot(sim_ts)&lt;br /&gt;
&lt;br /&gt;
====Exponential Models====&lt;br /&gt;
&lt;br /&gt;
*The '''HoltWinters()''' function ('''stats''' package), and the '''ets()''' function ('''forecast''' package) can fit exponential models.&lt;br /&gt;
 # simple exponential - models level&lt;br /&gt;
 fit_HW &amp;lt;- HoltWinters(sim_ts, beta=FALSE, gamma=FALSE)&lt;br /&gt;
 &lt;br /&gt;
 # double exponential - models level and trend&lt;br /&gt;
 fit_HW2&amp;lt;- HoltWinters(sim_ts, gamma=FALSE) &lt;br /&gt;
 &lt;br /&gt;
 # triple exponential - models level, trend, and seasonal components&lt;br /&gt;
 fit_HW3 &amp;lt;- HoltWinters(sim_ts)&lt;br /&gt;
 &lt;br /&gt;
 plot(fit_HW, col='black')&lt;br /&gt;
 par(new=TRUE)&lt;br /&gt;
 plot(fit_HW2, ann=FALSE, axes=FALSE, col='blue')&lt;br /&gt;
 par(new=TRUE)&lt;br /&gt;
 plot(fit_HW3, axes=FALSE, col='red')&lt;br /&gt;
 # clear plot: &lt;br /&gt;
 # dev.off()&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries18.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Auto-regressive Integrated Moving Average (ARIMA) Models&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
There are 2 types of ARIMA time-series models: &amp;lt;BR&amp;gt;&lt;br /&gt;
$ X_t= \mu+ \underbrace{\sum_{i=1}^{p}{φ_iX_{t-i}}}_\text{auto-regressive (p) part} +&lt;br /&gt;
\underbrace{\sum_{j=1}^{q}{θ_jε_{t-j}}}_\text{moving-average (q) part} + &lt;br /&gt;
\underbrace{ ε_t }_\text{error term}.$&lt;br /&gt;
&lt;br /&gt;
====Non-seasonal ARIMA models====&lt;br /&gt;
The Non-seasonal ARIMA models are denoted by ARIMA(p, d, q), where parameters p, d, and q are positive integers, &lt;br /&gt;
* p = order of the auto-regressive model,&lt;br /&gt;
* d = degree of differencing, when ''d''=2, the '''''d&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt;'' difference''' is $(X_t-X_{t-1})-(X_{t-1}-X_{t-2})= X_t-2X_{t-1}+X_{t-2}$. That is, the second difference of ''X'' (d=2) is not the difference between the current period and the value 2 periods ago.  It is the first-difference-of-the-first difference, the discrete analog of a second derivative, representing the local acceleration of the series rather than its local trend (first derivative).&lt;br /&gt;
* q = order of the moving-average model.&lt;br /&gt;
&lt;br /&gt;
====Seasonal ARIMA models====&lt;br /&gt;
The Seasonal AMIMA models are denoted by ''ARIMA(p, d, q)(P, D, Q)&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;,'' &lt;br /&gt;
* m = number of periods in each season, &lt;br /&gt;
* uppercase P, D, Q represent the auto-regressive, differencing, and moving average terms for the seasonal part of the ARIMA model, and the lower case (p,d,q) are as with non-seasonal ARIMA.&lt;br /&gt;
&lt;br /&gt;
If 2 of the 3 terms are trivial, the model is abbreviated using the non-zero parameter, skipping the &amp;quot;AR&amp;quot;, &amp;quot;I&amp;quot; or &amp;quot;MA&amp;quot; from the acronym. For example, &lt;br /&gt;
&lt;br /&gt;
*ARIMA(1,0,0) = AR(1), a stationary and auto-correlated series can be predicted as a multiple of its own previous value, plus a constant. $X_t=μ + φ_1 × X_{t-1}+ \epsilon_t.$ Note that $ε_t=X_t-\hat{X}_t.$&lt;br /&gt;
&lt;br /&gt;
*An ARIMA(0,1,0) = I(1) model, not stationary series, a limiting case of an AR(1) model, the auto-regressive coefficient is equal to 1, i.e., a series with infinitely slow mean reversion,  $X_t=μ+X_{t-1}+ε_t,$ a 1-step random walk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;For more complex models:&amp;lt;/B&amp;gt;&lt;br /&gt;
*An ARIMA(1,1,0), differenced first-order auto-regressive model.  $X_t=μ+X_{t-1}+α×(X_{t-1}-X_{t-2})+ε_t.$  &lt;br /&gt;
&lt;br /&gt;
*An ARIMA(0,2,2) model is given by $X_t=2X_{t-1}-X_{t-2}+α×ε_{t-1}+β×ε_{t-2}+ ε_t,$ where $α$ and $β$ are the MA(1) and MA(2) coefficients (sometimes these are defined with negative signs). This is a general linear exponential smoothing model that uses exponentially weighted moving averages to estimate both a local level and a local trend in the series.  The long-term forecasts from this model converge to a straight line whose slope depends on the average trend observed toward the end of the series.&lt;br /&gt;
&lt;br /&gt;
*ARIMA(1,1,2), $X_t=μ+X_{t-1}+(X_{t-1}+X_{t-2})+α×ε{t}+β×ε_{t-1}$&lt;br /&gt;
&lt;br /&gt;
The '''arima'''() function ('''stats''' package) can be used to fit an &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;auto-regressive integrated moving averages&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; model. Other useful functions include:&lt;br /&gt;
* lag(sim_ts, k) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; lagged version of time series, shifted back k observations&lt;br /&gt;
* diff(sim_ts, differences=d) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; difference the time series d times&lt;br /&gt;
* ndiffs(sim_ts) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Number of differences required to achieve stationarity (from the forecast package)&lt;br /&gt;
* acf(sim_ts) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; auto-correlation function&lt;br /&gt;
* pacf(sim_ts) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; partial auto-correlation function&lt;br /&gt;
* adf.test(sim_ts) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Augmented Dickey-Fuller test. Rejecting the null hypothesis suggests that a time series is stationary (from the tseries package)&amp;lt;/li&amp;gt;&lt;br /&gt;
* Box.test(x, type=&amp;quot;Ljung-Box&amp;quot;) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Portmanteau test that observations in vector or time series x are independent.&lt;br /&gt;
&lt;br /&gt;
The '''forecast''' package has alternative versions of '''acf()''' and '''pacf()''' called '''Acf()''' and '''Pacf()''' respectively. &lt;br /&gt;
&amp;amp;#35; fit an '''ARIMA(P, D, Q) model''' of order:&lt;br /&gt;
* P, represents the AR order&amp;lt;&lt;br /&gt;
* D, represents the degree of differencing&lt;br /&gt;
* Q, represents the MA order.&lt;br /&gt;
&lt;br /&gt;
 fit_arima1 &amp;lt;- arima(sim_ts, order=c(3, 1, 2))  &lt;br /&gt;
 # predictive accuracy &lt;br /&gt;
 library(forecast) &lt;br /&gt;
 accuracy(fit_arima1)  &lt;br /&gt;
 &lt;br /&gt;
 # predict next 20 observations &lt;br /&gt;
 library(forecast) &lt;br /&gt;
 forecast(fit_arima1, 20) &lt;br /&gt;
 plot(forecast(fit_arima1, 20)) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_TimeSeries19.png|600px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Forecasting===&lt;br /&gt;
&lt;br /&gt;
The '''forecast''' package provides functions for the automatic selection of exponential and ARIMA models. The '''ets()''' (exponential TS) function supports both additive and multiplicative models. The '''auto.arima()''' function accounts for seasonal and nonseasonal ARIMA models according to criteria maximizing a cost function.&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35; library(forecast)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35; Automated forecasting using an exponential model&lt;br /&gt;
  fit_ets &amp;lt;- ets(sim_ts)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35; Automated forecasting using an ARIMA model&lt;br /&gt;
 fit_arima2 &amp;lt;- auto.arima(sim_ts)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35; Compare the AIC (model quality) for both models&lt;br /&gt;
 fit_ets$\$$aic; fit_arima2$\$$aic&lt;br /&gt;
 accuracy(fit_ets); accuracy(fit_arima2);&lt;br /&gt;
&lt;br /&gt;
'''Akaike’s Information Criterion (AIC)''' = ''-2Log(Likelihood)+2p,'' where ''p'' is he number of estimated parameters.&lt;br /&gt;
 summary(fit_ets); summary(fit_arima2)&lt;br /&gt;
&lt;br /&gt;
ACF plot of the residuals from the ARIMA(3,1,2) model shows all correlations within the threshold limits indicating that the residuals are behaving like white noise. A portmanteau test returns a large p-value, also suggesting the  residuals are white noise.&lt;br /&gt;
 &amp;amp;#35; acf computes (and by default plots) estimates of the autocovariance or autocorrelation function&lt;br /&gt;
 acf(residuals(fit_ets)) &lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35; Box–Pierce or Ljung–Box test statistic for examining the null hypothesis of independence in a given time series. &lt;br /&gt;
 &amp;amp;#35; These are sometimes known as ‘portmanteau’ tests.&lt;br /&gt;
 Box.test(residuals(fit_ets), lag=24, fitdf=4, type=&amp;quot;Ljung&amp;quot;)&lt;br /&gt;
 &amp;amp;#35; plot forecast&lt;br /&gt;
 &lt;br /&gt;
 plot(forecast(fit_arima2))&lt;br /&gt;
 &amp;amp;#35; more on ARIMA https://www.otexts.org/fpp/8/7&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
* &amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; https://umich.instructure.com/files/689861/download?download_frd=1  &lt;br /&gt;
* &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; https://umich.instructure.com/courses/38100/files  &lt;br /&gt;
* &amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; https://cran.r-project.org/web/packages/mgcv/mgcv.pdf&lt;br /&gt;
* &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; http://arxiv.org/ftp/arxiv/papers/1302/1302.6613.pdf&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_TimeSeriesAnalysis_LOS| Applications of Time-series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.ucla.edu&lt;br /&gt;
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=SMHS_TimeSeriesAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal_LDA_QDA&amp;diff=16248</id>
		<title>SMHS BigDataBigSci CrossVal LDA QDA</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal_LDA_QDA&amp;diff=16248"/>
		<updated>2016-05-24T14:09:20Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci_CrossVal| Big Data Science and Cross Validation]] - Foundation of LDA and QDA for prediction, dimensionality reduction or forecasting==&lt;br /&gt;
&lt;br /&gt;
===Summary===&lt;br /&gt;
Both LDA (Linear Discriminant Analysis) and QDA (Quadratic Discriminant Analysis) use probabilistic models of the class conditional distribution of the data $P(X|Y=k)$ for each class $k$. Their predictions are obtained by using Bayesian theorem (http://wiki.socr.umich.edu/index.php/SMHS_BayesianInference#Bayesian_Rule):&lt;br /&gt;
&lt;br /&gt;
\begin{equation}&lt;br /&gt;
P(Y=k|X)=\frac{P(X|Y=k)P(Y=k)}{P(X)}=\frac{P(X|Y=k)P(Y=k)}{\sum_{l=0}^&amp;amp;#8734;P(X|Y=l)P(Y=l)'}&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
and we select the class $k$, which '''maximizes''' this conditional probability (maximum likelihood estimation).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In linear and quadratic discriminant analysis, $P(X|Y)$  is modeled as a multivariate Gaussian distribution with density:&lt;br /&gt;
&lt;br /&gt;
\begin{equation}&lt;br /&gt;
P(X|Y=k)=\frac{1}{(2\pi)^n|\sum_k|^{1/2}}×e^{\Big(-\frac{1}{2}(x-\mu_k)^T\sum_k^{-1}(X-\mu_k)\Big)}&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This model can be used to classify data by using the training data to '''estimate''':&lt;br /&gt;
&lt;br /&gt;
(1) the class prior probabilities $P(Y = k)$ by counting the proportion of observed instances of class $k$, &lt;br /&gt;
&lt;br /&gt;
(2) the class means $μ_k$ by computing the empirical sample class means, and &lt;br /&gt;
&lt;br /&gt;
(3) the covariance matrices by computing either the empirical sample class covariance matrices, or by using a regularized estimator, e.g., lasso). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;u&amp;gt;linear case&amp;lt;/u&amp;gt; (LDA), the Gaussians for each class are assumed to share the same covariance matrix:&lt;br /&gt;
&lt;br /&gt;
$Σ_k=Σ$ for each class $k$. This leads to linear decision surfaces between classes. This is clear from comparing the log-probability ratios of 2 classes ($k$ and $l$):&lt;br /&gt;
&lt;br /&gt;
$LOR=log\Big(\frac{P(Y=k│X)}{P(Y=l│X)}\Big)$&lt;br /&gt;
(the LOR=0 ↔the two probabilities are identical, i.e., same class) &lt;br /&gt;
&lt;br /&gt;
$LOR=log\Big(\frac{P(Y=k│X}{P(Y=l│X)}\Big)=0 ⇔ (\mu_k-\mu_l)^T\sum^{-1}(\mu_k-\mu_1)=\frac{1}{2}({\mu_k}^T\sum^{-1}\mu_k-{\mu_l}^T\sum^{-1}\mu_l) $&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But, in the more general, &amp;lt;u&amp;gt;quadratic case&amp;lt;/u&amp;gt; of QDA, there are no assumptions on the covariance matrices $Σ_k$ of the Gaussians, leading to quadratic decision surfaces.&lt;br /&gt;
&lt;br /&gt;
==LDA (Linear Discriminant Analysis)==&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;LDA is similar to GLM (e.g., ANOVA and regression analyses), as it also attempt to express one dependent variable as a linear combination of other features or data elements, However, ANOVA uses categorical independent variables and a continuous dependent variable, whereas LDA has continuous independent variables and a categorical dependent variable (i.e. Dx/class label). Logistic regression and probit regression are more similar to LDA than ANOVA, as they also explain a categorical variable by the values of continuous independent variables.&lt;br /&gt;
&lt;br /&gt;
 predfun.lda = function(train.x, train.y, test.x, test.y, neg)&lt;br /&gt;
 {&lt;br /&gt;
 require(&amp;quot;MASS&amp;quot;)&lt;br /&gt;
 lda.fit = lda(train.x, grouping=train.y)&lt;br /&gt;
 ynew = predict(lda.fit, test.x)$\$$class&lt;br /&gt;
 out.lda = confusionMatrix(test.y, ynew, negative=neg)&lt;br /&gt;
 return( out.lda )&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==QDA (Quadratic Discriminant Analysis)==&lt;br /&gt;
&lt;br /&gt;
 predfun.qda = function(train.x, train.y, test.x, test.y, neg)&lt;br /&gt;
 {&lt;br /&gt;
 require(&amp;quot;MASS&amp;quot;) # for lda function&lt;br /&gt;
 qda.fit = qda(train.x, grouping=train.y)&lt;br /&gt;
 ynew = predict(qda.fit, test.x)$\$$class&lt;br /&gt;
 out.qda = confusionMatrix(test.y, ynew, negative=neg)&lt;br /&gt;
 return( out.qda )&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==k-Nearest Neighbors algorithm==&lt;br /&gt;
&lt;br /&gt;
k-Nearest Neighbors algorithm (''k''-NN) is a non-parametric method for either classification or regression, where the &amp;lt;u&amp;gt;input&amp;lt;/u&amp;gt; consists of the ''k'' closest '''training examples''' in the feature space, but the &amp;lt;u&amp;gt;output&amp;lt;/u&amp;gt; depends on whether ''k''-NN is used for classification or regression:&lt;br /&gt;
&lt;br /&gt;
*In ''k''-NN '''classification''', the output is a class membership (labels). Objects in the testing data are classified by a majority vote of their neighbors. Each object is assigned to a class that is most common among its ''k'' nearest neighbors (''k'' is always a small positive integer). When ''k''=1, then an object is assigned to the class of its single nearest neighbor.&lt;br /&gt;
&lt;br /&gt;
*In ''k''-NN '''regression''', the output is the property value for the object representing the average of the values of its ''k'' nearest neighbors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;X = as.matrix(input) &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; # Predictor variables X = as.matrix(input.short2)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Y = as.matrix(output)  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; # Outcome&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;'''&amp;amp;#35;KNN (k-nearest neighbors)'''&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     library(&amp;quot;class&amp;quot;)&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;knn.fit.test &amp;lt;- knn(X, X, cl = Y, k=3, prob=F); predict(as.matrix(knn.fit.test), X) $\$$class &amp;lt;/span&amp;gt;&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;table(knn.fit.test, Y); confusionMatrix(Y, knn.fit.test, negative=&amp;quot;1&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;This can be used for polytomous variable (multiple classes)&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     predfun.knn = function(train.x, train.y, test.x, test.y, neg)&lt;br /&gt;
     {&lt;br /&gt;
     require(&amp;quot;class&amp;quot;)&lt;br /&gt;
     knn.fit = knn(train.x, test.x, cl = train.y, prob=T) 	&amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;# knn is already a prediction function!!!&amp;lt;/span&amp;gt;&lt;br /&gt;
     &amp;amp;#35;ynew = predict(knn.fit, test.x)$\$$class			# no need of another prediction, in this case&lt;br /&gt;
     out.knn = confusionMatrix(test.y, knn.fit, negative=neg)&lt;br /&gt;
     return( out.knn )&lt;br /&gt;
     }&lt;br /&gt;
 &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;cv.out.knn = '''crossval::crossval'''(predfun.knn, X, Y, K=5, B=2, neg=&amp;quot;1&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Compare all 3 classifiers (lda, qda, knn, and logit)&lt;br /&gt;
&lt;br /&gt;
 diagnosticErrors(cv.out.lda$\$$stat); diagnosticErrors(cv.out.qda$\$$stat); diagnosticErrors(cv.out.qda$\$$stat); &lt;br /&gt;
 diagnosticErrors(cv.out.logit$\$$stat);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS BigDataBigSci CrossVal5.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;'''Now let’s look at the actual prediction models!'''&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are different approaches to split the data (partition the data) into Training and Testing sets.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;TRAINING: 75% of the sample size&lt;br /&gt;
&lt;br /&gt;
 sample_size &amp;lt;- floor(0.75 * nrow(input))&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;set the seed to make your partition reproducible&lt;br /&gt;
 set.seed(1234)&lt;br /&gt;
 input.train.ind &amp;lt;- sample(seq_len(nrow(input)), size = sample_size)&lt;br /&gt;
 input.train &amp;lt;- input[input.train.ind, ]&lt;br /&gt;
 output.train &amp;lt;- as.matrix(output)[input.train.ind, ]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;TESTING DATA&lt;br /&gt;
&lt;br /&gt;
 input.test &amp;lt;- input[-input.train.ind, ]&lt;br /&gt;
 output.test &amp;lt;- as.matrix(output)[-input.train.ind, ]&lt;br /&gt;
&lt;br /&gt;
==k-Means Clustering (k-MC)==&lt;br /&gt;
&lt;br /&gt;
k-MC aims to partition ''n'' observations into ''k'' clusters where each observation belongs to the cluster with the nearest mean which acts as a prototype of a cluster. The k-MC partitions the data space into Voronoi cells. In general there is no computationally tractable solution (NP-hard problem), but there are efficient algorithms that converge quickly to local optima (e.g., expectation-maximization algorithm for mixtures of Gaussian distributions via an iterative refinement approach employed by both algorithms&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 kmeans_model &amp;lt;- kmeans(input.train, 2)&lt;br /&gt;
 layout(matrix(1,1))&lt;br /&gt;
 plot(input.train, col = kmeans_model$\$$cluster) &lt;br /&gt;
 points(kmeans_model$\$$centers, col = 1:2, pch = 8, cex = 2)&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;cluster centers &amp;quot;fitted&amp;quot; to each obs.:&lt;br /&gt;
 fitted.kmeans &amp;lt;- fitted(kmeans_model);  head(fitted.kmeans)&lt;br /&gt;
 resid.kmeans &amp;lt;- (input.train - fitted(kmeans_model))&lt;br /&gt;
 &amp;amp;#35;define the sum of squares function	&lt;br /&gt;
 ss &amp;lt;- function(data) sum(scale(data, scale = FALSE)^2)&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;Equalities &lt;br /&gt;
 cbind(kmeans_model[c(&amp;quot;betweenss&amp;quot;, &amp;quot;tot.withinss&amp;quot;, &amp;quot;totss&amp;quot;)], 	# the same two columns&lt;br /&gt;
     c (ss(fitted.kmeans), ss(resid.kmeans),  ss(input.train)))&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;validation&lt;br /&gt;
 stopifnot(all.equal(kmeans_model$\$$totss,        ss(input.train)),&lt;br /&gt;
     all.equal(kmeans_model$\$$tot.withinss, ss(resid.kmeans)),&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;these three are the same:&lt;br /&gt;
     all.equal(kmeans_model$\$$betweenss,    ss(fitted.kmeans)),&lt;br /&gt;
     all.equal(kmeans_model$\$$betweenss, kmeans_model$\$$totss - kmeans_model$\$$tot.withinss),&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;and hence also&lt;br /&gt;
     all.equal(ss(input.train), ss(fitted.kmeans) + ss(resid.kmeans))&lt;br /&gt;
 )&lt;br /&gt;
 kmeans(input.train,1)$\$$withinss &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; # trivial one-cluster, (its W.SS == ss(input.train))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;http://escholarship.org/uc/item/1rb70972&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''(1)&amp;amp;#35;&amp;amp;#35; k-Nearest Neighbor Classification'''&lt;br /&gt;
&lt;br /&gt;
 library(&amp;quot;class&amp;quot;)&lt;br /&gt;
 knn_model &amp;lt;- knn(train= input.train, input.test, cl=as.factor(output.train), k=2)&lt;br /&gt;
 plot(knn_model)&lt;br /&gt;
 summary(knn_model)&lt;br /&gt;
 attributes(knn_model)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;cross-validation&lt;br /&gt;
 knn_model.cv &amp;lt;- knn.cv(train= input.train, cl=as.factor(output.train), k=2)&lt;br /&gt;
 summary(knn_model.cv)&lt;br /&gt;
&lt;br /&gt;
==Appendix: R Debugging==&lt;br /&gt;
&lt;br /&gt;
Most programs that give incorrect results are impacted by logical errors. When errors (bugs, exceptions) occur, we need explore deeper -- this procedure to identify and fix bugs is “debugging”.&lt;br /&gt;
&lt;br /&gt;
R tools for debugging: traceback(), debug() browser() trace() recover()&lt;br /&gt;
&lt;br /&gt;
'''traceback():''' Failing R functions report to the screen immediately the error. Calling traceback() will show the function where the error occurred. The traceback() function prints the list of functions that were called before the error occurred.&lt;br /&gt;
The function calls are printed in reverse order.&lt;br /&gt;
&lt;br /&gt;
f1&amp;lt;-function(x) { r&amp;lt;- x-g1(x); r }&lt;br /&gt;
&lt;br /&gt;
g1&amp;lt;-function(y) { r&amp;lt;-y*h1(y); r }&lt;br /&gt;
&lt;br /&gt;
h1&amp;lt;-function(z) { r&amp;lt;-log(z); if(r&amp;lt;10) r^2 else   r^3}&lt;br /&gt;
&lt;br /&gt;
f1(-1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Error in if (r &amp;lt; 10) r^2 else r^3 : missing value where TRUE/FALSE needed In addition: Warning message:&lt;br /&gt;
In log(z) : NaNs produced&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 traceback() &lt;br /&gt;
 3:  h(y)&lt;br /&gt;
 2: g(x)&lt;br /&gt;
 1: f(-1)&lt;br /&gt;
 &lt;br /&gt;
 debug()&lt;br /&gt;
&lt;br /&gt;
traceback() does not tell you where is the error. To find out which line causes the error, we may step through the function using debug().&lt;br /&gt;
&lt;br /&gt;
debug(foo) flags the function foo() for debugging. undebug(foo) unflags the function.&lt;br /&gt;
&lt;br /&gt;
When a function is flagged for debugging, each statement in the function is executed one at a time. After a statement is executed, the function suspends and user can interact with the R shell.&lt;br /&gt;
&lt;br /&gt;
This allows us to inspect a function line-by-line.&lt;br /&gt;
&lt;br /&gt;
'''Example''': compute sum of squared error SS&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35; compute sum of squares &lt;br /&gt;
 SS&amp;lt;-function(mu,x) {  d&amp;lt;-x-mu; d2&amp;lt;-d^2; ss&amp;lt;-sum(d2);  ss }&lt;br /&gt;
 set.seed(100);  x&amp;lt;-rnorm(100); SS(1,x)&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35; to debug&lt;br /&gt;
 debug(SS); SS(1,x)&lt;br /&gt;
 debugging in: SS(1, x) debug: {&lt;br /&gt;
 d &amp;lt;- x - mu d2 &amp;lt;- d^2&lt;br /&gt;
 ss  &amp;lt;-  sum(d2) ss&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
In the debugging shell (“Browse[1]&amp;gt;”), users can:&lt;br /&gt;
&lt;br /&gt;
•	Enter &amp;lt;u&amp;gt;'''n'''&amp;lt;/u&amp;gt; (next) executes the current line and prints the next one; &lt;br /&gt;
&lt;br /&gt;
•	Typing &amp;lt;u&amp;gt;'''c'''&amp;lt;/u&amp;gt; (continue) executes the rest of the function without stopping; &lt;br /&gt;
&lt;br /&gt;
•	Enter &amp;lt;u&amp;gt;'''Q'''&amp;lt;/u&amp;gt; quits the debugging;&lt;br /&gt;
&lt;br /&gt;
•	Enter &amp;lt;u&amp;gt;'''ls()'''&amp;lt;/u&amp;gt; list all objects in the local environment;&lt;br /&gt;
&lt;br /&gt;
•	Enter an object name or print(&amp;lt;object name&amp;gt;) tells the current value of an object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 debug(SS)&lt;br /&gt;
 SS(1,x)&lt;br /&gt;
 debugging in: SS(1, x) debug: {&lt;br /&gt;
 d &amp;lt;- x - mu d2 &amp;lt;- d^2&lt;br /&gt;
 ...&lt;br /&gt;
 Browse[1]&amp;gt;  n&lt;br /&gt;
 debug: d &amp;lt;- x - mu  		## the next command &lt;br /&gt;
 Browse[1]&amp;gt;  ls()		##  current  environment [1] &amp;quot;mu&amp;quot; &amp;quot;x&amp;quot;	        ## there is no d&lt;br /&gt;
 Browse[1]&amp;gt;  n			## go one step debug:  d2  &amp;lt;-  d^2	        ## the next command&lt;br /&gt;
 Browse[1]&amp;gt; ls()	                ## current environment [1] &amp;quot;d&amp;quot;   &amp;quot;mu&amp;quot; &amp;quot;x&amp;quot;       ## d has been created&lt;br /&gt;
 Browse[1]&amp;gt; d[1:3]		## first three elements of d [1] -1.5021924 -0.8684688 -1.0789171&lt;br /&gt;
 Browse[1]&amp;gt; hist(d)  		## histogram of d&lt;br /&gt;
 Browse[1]&amp;gt; where		## current position in call stack where 1: SS(1, x)&lt;br /&gt;
 Browse[1]&amp;gt;  n&lt;br /&gt;
 debug: ss &amp;lt;- sum(d2) &lt;br /&gt;
 Browse[1]&amp;gt; Q			##  quit&lt;br /&gt;
 &lt;br /&gt;
 '''undebug(SS)'''	                ## remove debug label, stop debugging process&lt;br /&gt;
 SS(1,x)		                ## now call SS again will without debugging&lt;br /&gt;
&lt;br /&gt;
You can label a function for debugging while debugging another function&lt;br /&gt;
&lt;br /&gt;
 f&amp;lt;-function(x) { r&amp;lt;-x-g(x); r }&lt;br /&gt;
 g&amp;lt;-function(y) { r&amp;lt;-y*h(y); r }&lt;br /&gt;
 h&amp;lt;-function(z) { r&amp;lt;-log(z); if(r&amp;lt;10) r^2 else r^3 }&lt;br /&gt;
&lt;br /&gt;
 debug(f)			# ## If you only debug f, you will not go into g&lt;br /&gt;
 f(-1)&lt;br /&gt;
 Browse[1]&amp;gt; n&lt;br /&gt;
 Browse[1]&amp;gt; n&lt;br /&gt;
 &amp;lt;i&amp;gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Error in if (r &amp;lt; 10) r^2 else r^3 : missing value where TRUE/FALSE needed In addition: Warning message:&amp;lt;/i&amp;gt; &lt;br /&gt;
 &amp;lt;i&amp;gt;In log(z) : NaNs produced&amp;lt;/font&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But, we can also label ''g'' and ''h'' for debugging when we debug ''f''&lt;br /&gt;
&lt;br /&gt;
 f(-1)&lt;br /&gt;
 Browse[1]&amp;gt;  n&lt;br /&gt;
 Browse[1]&amp;gt; debug(g) &lt;br /&gt;
 Browse[1]&amp;gt; debug(h) &lt;br /&gt;
 Browse[1]&amp;gt; n&lt;br /&gt;
&lt;br /&gt;
Inserting a call to '''browser()''' in a function will pause the execution of a function at the point where browser() is called.&lt;br /&gt;
Similar to using debug() except you can control where execution gets paused.&lt;br /&gt;
&lt;br /&gt;
'''Example:'''&lt;br /&gt;
 h&amp;lt;-function(z) {&lt;br /&gt;
 browser() 	## a break point inserted here &lt;br /&gt;
 r&amp;lt;-log(z); if(r&amp;lt;10) r^2 else r^3&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 f(-1)&lt;br /&gt;
 Browse[1]&amp;gt; ls() &lt;br /&gt;
 Browse[1]&amp;gt; z&lt;br /&gt;
 Browse[1]&amp;gt; n&lt;br /&gt;
 Browse[1]&amp;gt;  n&lt;br /&gt;
 Browse[1]&amp;gt; ls()&lt;br /&gt;
 Browse[1]&amp;gt; c&lt;br /&gt;
&lt;br /&gt;
Calling '''trace()''' on a function allows inserting new code into a function. The syntax for trace() may be challenging.&lt;br /&gt;
&lt;br /&gt;
 as.list(body(h)) &lt;br /&gt;
 trace(&amp;quot;h&amp;quot;,quote(if(is.nan(r)) {browser()}), at=3, print=FALSE)&lt;br /&gt;
 f(1)&lt;br /&gt;
 f(-1)&lt;br /&gt;
 &lt;br /&gt;
 trace(&amp;quot;h&amp;quot;,quote(if(z&amp;lt;0) {z&amp;lt;-1}), at=2, print=FALSE)&lt;br /&gt;
 f(-1)&lt;br /&gt;
 untrace()&lt;br /&gt;
&lt;br /&gt;
During the debugging process, '''recover()''' allows checking the status of variables in upper level functions. recover() can be used as an error handler using '''options()''' (e.g. options(error=recover)). When functions throw exceptions, execution stops at point of failure. Browsing the function calls and examining the environment may indicate the source of the problem.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci_CrossVal_| Back to Big Data Science and Cross-Validation]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Growth Curve Modeling (GCM)]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
* [[SMHS_BigDataBigSci|Back to Big Data Science]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal_LDA_QDA}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal&amp;diff=16247</id>
		<title>SMHS BigDataBigSci CrossVal</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal&amp;diff=16247"/>
		<updated>2016-05-24T14:08:48Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Big Data Science]] - (Internal) Statistical Cross-Validaiton ==&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
* What does it mean to validate a result, a method, approach, protocol, or data?&lt;br /&gt;
* Can we do “pretend” validations that closely mimic reality?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci_CrossVal1.png|250px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Validation'' is the scientific process of determining the degree of accuracy of a mathematical, analytic or computational model as a representation of the real world based on the intended model use. There are various challenges with using observed experimental data for model validation:&lt;br /&gt;
&lt;br /&gt;
1.	Incomplete details of the experimental conditions may be subject to boundary and initial conditions, sample or material properties, geometry or topology of the system/process.&lt;br /&gt;
&lt;br /&gt;
2.	Limited information about measurement errors due to lack of experimental uncertainty estimates.&lt;br /&gt;
&lt;br /&gt;
Empirically observed data may be used to evaluate models with conventional statistical tests applied subsequently to test null hypotheses (e.g., that the model output is correct). In this process, the discrepancy between some model-predicted values and their corresponding/observed counterparts are compared. For example, a regression model predicted values may be compared to empirical observations. Under parametric assumptions of normal residuals and linearity, we could test null hypotheses like $slope = 1$ or $intercept = 0$. When comparing the model obtained on one training dataset to an independent dataset, the slope may be different from 1 and/or the intercept may be different from 0.  The purpose   of the regression comparison is a formal test of the hypothesis (e.g., $slope = 1, mean_{ observed} =mean_{ predicted},$ then the distributional properties of the adjusted estimates are critical in making an accurate inference. The logistic regression test is another example for comparing predicted and observed values. Measurement errors may creep in, due to sampling or analytical biases, instrument reading or recording errors, temporal or spatial sampling sample collection discrepancies, etc.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
====Cross-validation====&lt;br /&gt;
&lt;br /&gt;
Cross-validation is a method for validating of models by assessing the reliability and stability of the results of a statistical analysis (e.g., model predictions) based on independent datasets. For prediction of trend, association, clustering, etc., a model is usually trained on one dataset (training data) and tested on new unknown data (testing dataset). The cross-validation method defines a test dataset to evaluate the model avoiding overfitting (the process when a computational model describes random error, or noise, instead of underlying relationships in the data).&lt;br /&gt;
&lt;br /&gt;
====Overfitting====&lt;br /&gt;
&lt;br /&gt;
'''Example (US Presidential Elections):''' By 2014, there have been only '''56 presidential elections and 43 presidents'''. That is a small dataset, and learning from it may be challenging. &amp;lt;u&amp;gt;'''If the predictor space expands to include things like having false teeth, it's pretty easy for the model to go from fitting the generalizable features of the data (the signal) and to start matching the noise.'''&amp;lt;/u&amp;gt; When this happens, the quality of the fit on the historical data may improve (e.g., better R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;), but the model may fail miserably when used to make inferences about future presidential elections.&lt;br /&gt;
&lt;br /&gt;
(Figure from http://xkcd.com/1122/)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS BigDataBigSci_CrossVal2.png|400px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example (Google Flu Trends):''' A March 14, 2014 article in Science (''DOI: 10.1126/science.1248506''), identified problems in Google Flu Trends (http://www.google.org/flutrends/about/#US), DOI  10.1371/journal.pone.0023610, which may be attributed in part to overfitting.   In February 2013, Nature reported that GFT was predicting more than double the proportion of doctor visits for influenza-like illness (ILI) than the Centers for Disease Control and Prevention (CDC), despite the fact that GFT was built to predict CDC reports.&lt;br /&gt;
&lt;br /&gt;
GFT model found the best matches among 50 million search terms to fit 1,152 data points. The odds of finding search terms that match the propensity of the flu but are structurally unrelated, and so do not predict the future, were quite high. GFT developers, in fact, report weeding out seasonal search terms unrelated to the flu but strongly correlated to the CDC data, e.g., high school basketball season. The big GFT data may have overfitted the small number of cases. The GFT approach missed the non-seasonal 2009 influenza A–H1N1 pandemic.&lt;br /&gt;
&lt;br /&gt;
'''Example (Autism).''' Autistic brains constantly overfit visual and cognitive stimuli. To an autistic person, a general conversation of several adults may seem like a cacophony due to super-sensitive detail-oriented hearing and perception tuned to literally pick up all elements of the conversation and the environment but downplay body language, sarcasm and non-literal cues. We can miss the forest for the trees when we start &amp;quot;overfitting,&amp;quot; over-interpreting the noise on top of the actual signal. Ambient noise, trivial observations and unrelated perceptions may hide the true communication details.&lt;br /&gt;
&lt;br /&gt;
During each communication (conversation) there are exchanges of both information and random noise. Fitting a perfect model is only listening to the “relevant” information. Over-fitting is when your attention is (excessively) consumed with the noise, or worse, letting the noise drown out the information exchange.&lt;br /&gt;
&lt;br /&gt;
Any dataset is a mix of signal and noise. The main task of our brains are to sort these components and interpret the information (i.e., ignore the noise).&lt;br /&gt;
	&lt;br /&gt;
Our predictions are most accurate if we can model as much of the signal as possible and as little of the noise as possible. Note that in these terms, R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; is a poor metric to identify predictive power - it measures how much of the signal &amp;lt;u&amp;gt;'''and'''&amp;lt;/u&amp;gt; the noise is explained by our model. In practice, it's hard to always identify what's signal and what's noise. This is why practical applications tends to favor simpler models, since the more complicated a model is the easier it is to overfit the noise component in the information.&lt;br /&gt;
&lt;br /&gt;
'''Cross-validation is an iterative process''', where each step involves:&lt;br /&gt;
&lt;br /&gt;
*Randomly partitioning a sample of data into 2 complementary subsets (training + testing), &lt;br /&gt;
&lt;br /&gt;
*Performing the analysis on the training subset &lt;br /&gt;
&lt;br /&gt;
*Validating the analysis on the testing subset &lt;br /&gt;
&lt;br /&gt;
*Increase the iteration index and repeat the process (termination criteria can involve a fixed number, or a desired (mean?) variability or error-rate).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS BigDataBigSci_CrossVal3.png|400px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The validation results at each iteration are averaged, to reduce noise/variability, and reported.&lt;br /&gt;
&lt;br /&gt;
Cross-validation guards against testing hypotheses suggested by the data themselves (aka: &amp;quot;Type III errors&amp;quot;, False-Suggestion) in cases when new observations are hard to obtain (due to costs, reliability, time or other constraints). &lt;br /&gt;
&lt;br /&gt;
Cross-validation is different from ''conventional-validation'' (e.g. 80%-20% partitioning the data set into training and testing subsets) as the in the conventional validation, the error (e.g. Root Mean Square Error, RMSE) on the training data is not a useful estimator of model performance, as it does not generalize across multiple samples. Errors of the conventional-valuation based on the results on the test data do not assess model performance, in general. A more fair way to properly estimate model prediction performance is to use cross-validation, which combines (averages) prediction errors or measures of fit to correct for the stochastic nature of training and testing data partitions and generate a more accurate and robust estimate of real model performance.&lt;br /&gt;
&lt;br /&gt;
A more complex model ''overfits-the-data'', relative to a simpler model when the former generates accurate fitting results for known data but less accurate results when predicting based on new data (foresight). Knowledge from past experience includes information either ''relevant or irrelevant'' (noise) for the future information. In challenging data-driven predict models when uncertainty (entropy) is high, more noise is present in past information that needs to be ignored in future forecasting. However it is generally hard to discriminate patterns from noise in complex systems (i.e., deciding which part to model and which to ignore). Models that reduce the chance of fitting noise are called '''robust'''.&lt;br /&gt;
&lt;br /&gt;
====Example (Linear Regression)====&lt;br /&gt;
&lt;br /&gt;
We can demonstrate model assessment using linear regression. Suppose we observe response values $\{y_1,...,y_n\}$, and the corresponding $k$ predictors represented as a $kD$ vector of covariates $\{x_1,...,x_n\}$, where subjects/cases are indexed by $1 ≤ i ≤ n$, and the data-elements (variables) are indexed by $1 ≤ j ≤ k$.&lt;br /&gt;
&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
  x_{1,1} &amp;amp; \cdots &amp;amp; x_{1,k} \\&lt;br /&gt;
  \vdots  &amp;amp; \ddots &amp;amp; \vdots  \\&lt;br /&gt;
  x_{n,1} &amp;amp; \cdots &amp;amp; x_{n,k} &lt;br /&gt;
 \end{pmatrix}&lt;br /&gt;
&lt;br /&gt;
Using least squares to estimate the linear function parameters (effect-sizes), $\{β_1,...,β_k\}$, allows us to compute a hyperplane $y = a + xβ$ that best fits the observed data $\{x_i,y_i\}_{1≤i≤n}$. &lt;br /&gt;
&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
  y_{1} \\&lt;br /&gt;
  \vdots \\&lt;br /&gt;
  y_{n} &lt;br /&gt;
 \end{pmatrix}&lt;br /&gt;
&lt;br /&gt;
= \begin{pmatrix}&lt;br /&gt;
  α_{1} \\&lt;br /&gt;
  \vdots \\&lt;br /&gt;
  α_{n} &lt;br /&gt;
 \end{pmatrix}&lt;br /&gt;
&lt;br /&gt;
+\begin{pmatrix}&lt;br /&gt;
  x_{1,1} &amp;amp; \cdots &amp;amp; x_{1,k} \\&lt;br /&gt;
  \vdots  &amp;amp; \ddots &amp;amp; \vdots  \\&lt;br /&gt;
  x_{n,1} &amp;amp; \cdots &amp;amp; x_{n,k} &lt;br /&gt;
 \end{pmatrix}&lt;br /&gt;
&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
  β_{1} \\&lt;br /&gt;
  \vdots \\&lt;br /&gt;
  β_{k} &lt;br /&gt;
 \end{pmatrix}&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
  y_1=\alpha_1+x_{1,1}\beta_1+x_{1,2}\beta_2+...+x_{1,k}\beta_k\\&lt;br /&gt;
  y_2=\alpha_2+x_{2,1}\beta_1+x_{2,2}\beta_2+...+x_{2,k}\beta_k \\&lt;br /&gt;
  ...\\&lt;br /&gt;
  y_n=\alpha_n+x_{n,1}\beta_1+x_{n,2}\beta_2+...+x_{n,k}\beta_k&lt;br /&gt;
\end{array}$$&lt;br /&gt;
&lt;br /&gt;
The model fit may be evaluated using the mean squared error (MSE). The MSE for a given value of the parameters ''α'' and ''β'' on the observed training data $\{x_i,y_i\}_{1 ≤ i ≤ n}$.&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\begin{equation} MSE=\frac{1}{n}\sum_{i=1}^{n} \Bigg(y_i-\underbrace{(\alpha_1+x_{i,1}\beta_1+x_{i,2}\beta_2+\cdots+x_{i,k}\beta_k)}_{(\text{predicted value, } \hat{y_i} \text{, at }\{x_{i,1,}\cdots,x_{i,k}\})} \Bigg)^2&lt;br /&gt;
\end{equation} &lt;br /&gt;
$$&lt;br /&gt;
&amp;lt;center&amp;gt;vs.&amp;lt;/center&amp;gt;&lt;br /&gt;
$$&lt;br /&gt;
\begin{equation} RMSE=\sqrt{\frac{1}{n}\sum_{i=1}^{n} \Bigg(y_i-\underbrace{(\alpha_1+x_{i,1}\beta_1+x_{i,2}\beta_2+\cdots+x_{i,k}\beta_k)}_{(\text{predicted value, } \hat{y_i} \text{, at }\{x_{i,1,}\cdots,x_{i,k}\})} \Bigg)^2 }.&lt;br /&gt;
\end{equation} &lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
The expected value of the MSE (over the distribution of training sets) for the &amp;lt;u&amp;gt;'''training set'''&amp;lt;/u&amp;gt; is $\frac{(n-k-1)}{(n + k + 1)}  × E,$ where $E$ is the expected value of the MSE for the &amp;lt;u&amp;gt;'''testing'''&amp;lt;/u&amp;gt;/&amp;lt;u&amp;gt;'''validation'''&amp;lt;/u&amp;gt; data. Therefore, fitting a model and computing the MSE on the training set, we will get an over optimistic evaluation assessment (smaller RMSE) of how well the model may fit another dataset. This bias represents ''in-sample'' estimate of the fit, whereas we are interested in the cross-validation estimate as an ''out-of-sample'' estimate.&lt;br /&gt;
&lt;br /&gt;
In the linear regression model, cross validation is not useful as we can compute the &amp;lt;u&amp;gt;'''exact'''&amp;lt;/u&amp;gt; correction factor $\frac{(n - k - 1)}{(n + k + 1)}$ and correctly estimate the ''out-of-sample'' fit using the (MSE underestimate) ''in-sample'' MSE estimate. However, even in this situation, cross-validation remains useful as it can be used to select an optimal regularized cost function.&lt;br /&gt;
&lt;br /&gt;
In most other modeling procedures (e.g. logistic regression), &amp;lt;u&amp;gt;'''in general'''&amp;lt;/u&amp;gt;, there are no simple closed-form expressions (formulas) to adjust the cross-validation error estimate from the in-sample fit estimate. Cross-validation is generally applicable way to predict the performance of a model on a validation set using stochastic computation instead of obtaining experimental, theoretical, mathematical, or analytic error estimates.&lt;br /&gt;
&lt;br /&gt;
====Cross-validation methods====&lt;br /&gt;
&lt;br /&gt;
There are 2 classes of cross-validation approaches – exhaustive and non-exhaustive.&lt;br /&gt;
&lt;br /&gt;
'''Exhaustive cross-validation'''&lt;br /&gt;
&lt;br /&gt;
Exhaustive cross-validation methods are based on determining all possible ways to divide the original sample into training and testing data. For example, the ''Leave-m-out cross-validation'' involves using $m$ observations for testing and the remaining ($n-m$) observations as training (when $m=1$, leave-1-out method). This process is repeated on all partitions of the original sample. This method requires model fitting and validating $C_m^n$ times ($n$ is the total number of observations in the original sample and $m$ is the number left out for validation). This requires a very large number of steps&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Non-exhaustive cross-validation'''&lt;br /&gt;
&lt;br /&gt;
Non-exhaustive cross validation methods avoid computing estimates/errors using all possible partitionings of the original sample, but rather approximates these. For example, in the &amp;lt;u&amp;gt;'''''k''-fold cross-validation'''&amp;lt;/u&amp;gt;, the original sample is randomly partitioned into $k$ equal sized subsamples. Of the $k$ subsamples, a single subsample is kept as final testing data for validation of the model. The other $k- 1$ subsamples are used as training data. The cross-validation process is then repeated $k$ times ($k$ folds).  Each of the $k$ subsamples is used once as the validation data. There are corresponding $k$ results that are averaged (or otherwise aggregated) to generate a final model-quality estimation. In $k$-fold validation, all observations are used for both training and validation, and each observation is used for validation exactly once. In general, $k$ is a parameter that needs to be selected by investigator (common values may be 5, 10).&lt;br /&gt;
&lt;br /&gt;
A general case of the $k$-fold validation is $k=n$ (the total number of observations), when it coincides with the '''leave-one-out cross-validation'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A variation of the $k$-fold validation is &amp;lt;u&amp;gt;'''stratified k-fold cross-validation'''&amp;lt;/u&amp;gt;, where each fold has the same (approximately) mean response value. For instance, if the model represents a binary classification of cases (e.g., NC vs. PD), this implies that each fold contains roughly the same proportion of the 2 class labels.&lt;br /&gt;
&lt;br /&gt;
'''Repeated random sub-sampling validation''' splits randomly the entire dataset into training (where the model is fit) and testing data where the predictive accuracy is assessed). Again, the results are averaged over all iterative splits. This method has an advantage over $k$-fold cross validation as that the proportion of the training/testing split is not dependent on the number of iterations (folds). However, its drawback is that some observations may never be selected whereas others may be selected multiple-times in the testing/validation subsample, as validation subsets may overlap, and the results will vary each time we repeat the validation protocol (unless we set a seed point in the algorithm).&lt;br /&gt;
&lt;br /&gt;
Asymptotically, as the number of random splits increases, the ''repeated random sub-sampling validation'' approaches the ''leave-k-out cross-validation''.&lt;br /&gt;
&lt;br /&gt;
====Case-Studies====&lt;br /&gt;
&lt;br /&gt;
'''Example 1: Parkinson’s Diseases Study''' involving neuroimaging, genetics, clinical, and phenotypic data for over 600 volunteers produced multivariate data for 3 cohorts (HC=Healthy Controls, PD=Parkinson’s, SWEDD= subjects without evidence for dopaminergic deficit).&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35; update packages&lt;br /&gt;
 &amp;amp;#35; update.packages()&lt;br /&gt;
  &lt;br /&gt;
 &amp;amp;#35;load the data: 06_PPMI_ClassificationValidationData_Short.csv&lt;br /&gt;
 ppmi_data &amp;lt;-read.csv(&amp;quot;https://umich.instructure.com/files/330400/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
  &lt;br /&gt;
 &amp;amp;#35;binarize the Dx classes&lt;br /&gt;
 ppmi_data$\$$ResearchGroup &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup == &amp;quot;Control&amp;quot;, &amp;quot;Control&amp;quot;, &amp;quot;Patient&amp;quot;)&lt;br /&gt;
 attach(ppmi_data)&lt;br /&gt;
  &lt;br /&gt;
 head(ppmi_data)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35; Model-free analysis, classification&lt;br /&gt;
 &amp;amp;#35; install.packages(&amp;quot;crossval&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;library(&amp;quot;crossval&amp;quot;)&lt;br /&gt;
 require(crossval)&lt;br /&gt;
 require(ada)&lt;br /&gt;
 &amp;amp;#35;set up adaboosting prediction function&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;Define a new classification result-reporting function&lt;br /&gt;
 my.ada &amp;lt;- function (train.x, train.y, test.x, test.y, negative, formula){&lt;br /&gt;
     ada.fit &amp;lt;- ada(train.x, train.y)&lt;br /&gt;
     predict.y &amp;lt;- predict(ada.fit, test.x)&lt;br /&gt;
     &amp;amp;#35;count TP, FP, TN, FN, Accuracy, etc.&lt;br /&gt;
     out &amp;lt;- confusionMatrix(test.y, predict.y, negative = negative)&lt;br /&gt;
     &amp;amp;#35;negative	 is the label of a negative &amp;quot;null&amp;quot; sample (default: &amp;quot;control&amp;quot;).&lt;br /&gt;
     return (out)&lt;br /&gt;
 }&lt;br /&gt;
   &lt;br /&gt;
 &amp;amp;#35;balance cases&lt;br /&gt;
 &amp;amp;#35;SMOTE: Synthetic Minority Oversampling Technique to handle class misbalance in binary classification.&lt;br /&gt;
 set.seed(1000)&lt;br /&gt;
 &amp;amp;#35;install.packages(&amp;quot;unbalanced&amp;quot;) to deal with unbalanced group data&lt;br /&gt;
 require(unbalanced)&lt;br /&gt;
 ppmi_data$\$$PD &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup==&amp;quot;Control&amp;quot;,1,0) &lt;br /&gt;
 uniqueID &amp;lt;- unique(ppmi_data$\$$FID_IID) &lt;br /&gt;
 ppmi_data &amp;lt;- ppmi_data[ppmi_data$\$$VisitID==1,]&lt;br /&gt;
 '''ppmi_data$\$$PD &amp;lt;- factor(ppmi_data$\$$PD)'''&lt;br /&gt;
 &lt;br /&gt;
 colnames(ppmi_data)&lt;br /&gt;
 &amp;amp;#35;ppmi_data.1&amp;lt;-ppmi_data[,c(3:281,284,287,336:340,341)]&lt;br /&gt;
 n &amp;lt;- ncol(ppmi_data)&lt;br /&gt;
 output.1 &amp;lt;- ppmi_data$\$$PD&lt;br /&gt;
  &lt;br /&gt;
 &amp;amp;#35; remove Default Real Clinical subject classifications! &lt;br /&gt;
 ppmi_data$\$$PD &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup==&amp;quot;Control&amp;quot;,1,0) &lt;br /&gt;
 input &amp;lt;- ppmi_data[ ,-which(names(ppmi_data) %in% c(&amp;quot;ResearchGroup&amp;quot;,&amp;quot;PD&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;FID_IID&amp;quot;))]&lt;br /&gt;
 &amp;amp;#35; output &amp;lt;- as.matrix(ppmi_data[ ,which(names(ppmi_data) %in% {&amp;quot;PD&amp;quot;})])&lt;br /&gt;
 output &amp;lt;- as.factor(ppmi_data$\$$PD)&lt;br /&gt;
 c(dim(input), dim(output))&lt;br /&gt;
   &lt;br /&gt;
 &amp;amp;#35; balance the dataset&lt;br /&gt;
 data.1&amp;lt;-ubBalance(X= input, Y=output, type=&amp;quot;ubSMOTE&amp;quot;, percOver=300, percUnder=150, verbose=TRUE)&lt;br /&gt;
 balancedData&amp;lt;-cbind(data.1$\$$X, data.1$\$$Y)&lt;br /&gt;
 nrow(data.1$\$$X); ncol(data.1$\$$X)&lt;br /&gt;
 nrow(balancedData); ncol(balancedData)&lt;br /&gt;
 nrow(input); ncol(input)&lt;br /&gt;
 &lt;br /&gt;
 colnames(balancedData) &amp;lt;- c(colnames(input), &amp;quot;PD&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;&amp;amp;#35;Check balance&lt;br /&gt;
 &amp;amp;#35;&amp;amp;#35;T test&lt;br /&gt;
 alpha.0.05 &amp;lt;- 0.05&lt;br /&gt;
 test.results.bin &amp;lt;- NULL		# binarized/dichotomized p-values&lt;br /&gt;
 test.results.raw &amp;lt;- NULL		# raw p-values&lt;br /&gt;
  &lt;br /&gt;
 &amp;amp;#35; get a better error-handling t.test function that gracefully handles NA’s and trivial variances&lt;br /&gt;
 my.t.test.p.value &amp;lt;- function(input1, input2) {&lt;br /&gt;
     obj &amp;lt;- try(t.test(input1, input2), silent=TRUE) &lt;br /&gt;
     if (is(obj, &amp;quot;try-error&amp;quot;)) return(NA) else return('''obj$\$$p.value''')&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for (i in 1:ncol(balancedData)) &lt;br /&gt;
 {	&lt;br /&gt;
     test.results.raw[i]  &amp;lt;- my.t.test.p.value(input[,i], balancedData [,i])&lt;br /&gt;
     test.results.bin[i] &amp;lt;- ifelse(test.results.raw[i]  &amp;gt; alpha.0.05, 1, 0)   &lt;br /&gt;
     &amp;amp;#35; binarize the p-value (0=significant, 1=otherwise) &lt;br /&gt;
     print(c(&amp;quot;i=&amp;quot;, i, &amp;quot;var=&amp;quot;, colnames(balancedData[i]), &amp;quot;t-test_raw_p_value=&amp;quot;, test.results.raw[i]))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
     &amp;amp;#35;we can also employ (e.g., FDR, Bonferonni) &amp;lt;u&amp;gt;'''correction for multiple testing'''&amp;lt;/u&amp;gt;!&lt;br /&gt;
     &amp;amp;#35;test.results.corr &amp;lt;- '''stats::p.adjust'''(test.results.raw, method = &amp;quot;fdr&amp;quot;, n = length(test.results.raw)) &lt;br /&gt;
     &amp;amp;#35;where methods are &amp;quot;holm&amp;quot;, &amp;quot;hochberg&amp;quot;, &amp;quot;hommel&amp;quot;, &amp;quot;bonferroni&amp;quot;, &amp;quot;BH&amp;quot;, &amp;quot;BY&amp;quot;, &amp;quot;fdr&amp;quot;, &amp;quot;none&amp;quot;)&lt;br /&gt;
     &amp;amp;#35;plot(test.results.raw, test.results.corr)&lt;br /&gt;
     &amp;amp;#35;sum(test.results.raw &amp;lt; alpha.0.05, na.rm=T)/length(test.results.raw)  #check proportion of inconsistencies&lt;br /&gt;
     &amp;amp;#35;sum(test.results.corr &amp;lt; alpha.0.05, na.rm =T)/length(test.results.corr)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;as the sample-size is changed:&lt;br /&gt;
 length(input[,5]); length(balancedData [,5])&lt;br /&gt;
 &amp;amp;#35;to plot raw vs. rebalanced pairs (e.g., var=&amp;quot;L_insular_cortex_Volume&amp;quot;), we need to equalize the lengths&lt;br /&gt;
 plot (input[,5] +0*balancedData [,5], balancedData [,5])   # [,5] == &amp;quot;L_insular_cortex_Volume&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 print(c(&amp;quot;T-test results: &amp;quot;, test.results))&lt;br /&gt;
 &amp;amp;#35;zeros (0) are significant independent between-group T-test differences, ones (1) are insignificant&lt;br /&gt;
  &lt;br /&gt;
 for (i in 1:(ncol(balancedData)-1)) &lt;br /&gt;
 {&lt;br /&gt;
     test.results.raw [i]  &amp;lt;- wilcox.test(input[,i], balancedData [,i])$\$$p.value&lt;br /&gt;
     test.results.bin [i] &amp;lt;- ifelse(test.results.raw [i] &amp;gt; alpha.0.05, 1, 0)&lt;br /&gt;
     print(c(&amp;quot;i=&amp;quot;, i, &amp;quot;Wilcoxon-test=&amp;quot;, test.results.raw [i]))&lt;br /&gt;
 }&lt;br /&gt;
 print(c(&amp;quot;Wilcoxon test results: &amp;quot;, test.results.bin))&lt;br /&gt;
 &amp;amp;#35;test.results.corr &amp;lt;- '''stats::p.adjust'''(test.results.raw, method = &amp;quot;fdr&amp;quot;, n = length(test.results.raw)) &lt;br /&gt;
 &amp;amp;#35;where methods are &amp;quot;holm&amp;quot;, &amp;quot;hochberg&amp;quot;, &amp;quot;hommel&amp;quot;, &amp;quot;bonferroni&amp;quot;, &amp;quot;BH&amp;quot;, &amp;quot;BY&amp;quot;, &amp;quot;fdr&amp;quot;, &amp;quot;none&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;plot(test.results.raw, test.results.corr)&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;u&amp;gt;'''#cross validation'''&amp;lt;/u&amp;gt;&lt;br /&gt;
 &amp;amp;#35;using '''raw data''':&lt;br /&gt;
 X &amp;lt;- as.data.frame(input); Y &amp;lt;- output&lt;br /&gt;
 neg &amp;lt;- &amp;quot;1&amp;quot;   # &amp;quot;Control&amp;quot; == &amp;quot;1&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
&amp;amp;#35;using '''Rebalanced data''': &lt;br /&gt;
 X &amp;lt;- as.data.frame(data.1$\$$X); Y &amp;lt;- data.1$\$$Y&lt;br /&gt;
 &amp;amp;#35;balancedData&amp;lt;-cbind(data.1$\$$X, data.1$\$$Y); dim(balancedData)&lt;br /&gt;
 &lt;br /&gt;
&amp;amp;#35;'''Side note''': There is a function name collision for “crossval”, the same method is present in &lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;the “'''mlr'''” (machine Learning in R) package and in the “'''crossval'''” package.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;To specify a function call from a specific package do:  packagename::functionname()&lt;br /&gt;
 &lt;br /&gt;
 set.seed(115) &lt;br /&gt;
 &amp;amp;#35;cv.out &amp;lt;- crossval::crossval(my.ada, X, Y, K = 5, B = 1, negative = neg)&lt;br /&gt;
 cv.out &amp;lt;- '''crossval::crossval'''(my.ada, X, Y, K = 5, B = 1, negative = neg)&lt;br /&gt;
     &amp;amp;#35;the label of a negative &amp;quot;null&amp;quot; sample (default: &amp;quot;control&amp;quot;)&lt;br /&gt;
 out &amp;lt;- diagnosticErrors(cv.out$\$$stat) &lt;br /&gt;
 &lt;br /&gt;
 print(cv.out$\$$stat)&lt;br /&gt;
 print(out)&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|FP||TP||TN||FN&lt;br /&gt;
|-&lt;br /&gt;
|1.0||59.8||23.4||0.2&lt;br /&gt;
|}&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|acc||sens||spec||ppv||npv||lor &lt;br /&gt;
|-&lt;br /&gt;
|0.9857820||0.9966667||0.9590164||0.9835526||0.9915254||8.8531796 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Define a new LDA = Linear discriminant analysis predicting function&lt;br /&gt;
&lt;br /&gt;
require(&amp;quot;MASS&amp;quot;) # for lda function&lt;br /&gt;
 &lt;br /&gt;
 '''predfun.lda = function(train.x, train.y, test.x, test.y, negative)'''&lt;br /&gt;
 {   lda.fit = lda(train.x, grouping=train.y)&lt;br /&gt;
     ynew = predict(lda.fit, test.x)$\$$class&lt;br /&gt;
     &amp;amp;#35;count TP, FP etc.&lt;br /&gt;
     out = confusionMatrix(test.y, ynew, negative=negative)&lt;br /&gt;
     return( out )&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''(1) a simple example using the sleep dataset''' (containing the effect of two soporific drugs to increase hours of sleep (treatment-compared design) on 10 patients)&lt;br /&gt;
&lt;br /&gt;
 data(sleep)&lt;br /&gt;
 X = as.matrix(sleep[,1, drop=FALSE]) # increase in hours of sleep,&lt;br /&gt;
     &amp;amp;#35; drop is logical, if TRUE the result is coerced to the lowest possible dimension.&lt;br /&gt;
     &amp;amp;#35;The default is to drop if only one column is left, but not to drop if only one row is left.&lt;br /&gt;
 Y = sleep[,2] # drug given &lt;br /&gt;
 plot(X ~ Y)&lt;br /&gt;
 levels(Y) # &amp;quot;1&amp;quot; &amp;quot;2&amp;quot;&lt;br /&gt;
 dim(X) # 20  1&lt;br /&gt;
 &lt;br /&gt;
 set.seed(123456)&lt;br /&gt;
 cv.out &amp;lt;- '''crossval::crossval'''(predfun.lda, X, Y, K=5, B=20, negative=&amp;quot;1&amp;quot;)&lt;br /&gt;
 cv.out$\$$stat&lt;br /&gt;
 diagnosticErrors(cv.out$\$$stat)&lt;br /&gt;
&lt;br /&gt;
'''(2) A model-based example (linear regression) using the attitude dataset:''' &lt;br /&gt;
&lt;br /&gt;
'''&amp;amp;#35;?attitude, colnames(attitude)'''&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;&amp;quot;rating&amp;quot;     &amp;quot;complaints&amp;quot; &amp;quot;privileges&amp;quot; &amp;quot;learning&amp;quot;   &amp;quot;raises&amp;quot;     &amp;quot;critical&amp;quot;  &amp;quot;advance&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;aggregated survey of clerical employees of an organization, representing 35 employees of 30&lt;br /&gt;
 &lt;br /&gt;
&amp;amp;#35;(randomly selected) departments. Data=percent proportion of favorable responses to 7 questions in each department.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Note: when using a data frame, a time-saver is to use “.” to indicate “include all covariates&amp;quot; in the DF. &lt;br /&gt;
 &lt;br /&gt;
&amp;amp;#35;E.g., fit &amp;lt;- lm(Y ~ ., data = D)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 data(&amp;quot;attitude&amp;quot;)&lt;br /&gt;
 y = attitude[,1] 		# rating variable&lt;br /&gt;
 x = attitude[,-1] 	        # date frame with the remaining variables&lt;br /&gt;
 is.factor(y)&lt;br /&gt;
 summary( lm(y ~ . , data=x) ) 	# R-squared:  0.7326&lt;br /&gt;
 &amp;amp;#35;set up lm prediction function&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''predfun.lm = function(train.x, train.y, test.x, test.y)'''&lt;br /&gt;
 {   lm.fit = lm(train.y ~ . , data=train.x)&lt;br /&gt;
     ynew = predict(lm.fit, test.x )&lt;br /&gt;
     &amp;amp;#35;compute squared error risk (MSE)&lt;br /&gt;
     out = mean( (ynew - test.y)^2)&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;note that, in general, when fitting linear model to continuous outcome variable (Y),&amp;lt;/span&amp;gt;&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;we can’t use the '''out&amp;lt;-confusionMatrix(test.y, ynew, negative=negative)''', as it requires a binary outcome&amp;lt;/span&amp;gt;&lt;br /&gt;
     &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;&amp;amp;#35;this is why we use the MSE as an estimate of the discrepancy between observed &amp;amp; predicted values&amp;lt;/span&amp;gt; &lt;br /&gt;
     return(out)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;require(&amp;quot;MASS&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 '''predfun.lda = function(train.x, train.y, test.x, test.y, negative)'''&lt;br /&gt;
 {   lda.fit = lda(train.x, grouping=train.y)&lt;br /&gt;
     ynew = predict(lda.fit, test.x)$\$$class&lt;br /&gt;
     &amp;amp;#35;count TP, FP etc.&lt;br /&gt;
     out = confusionMatrix(test.y, ynew, negative=negative)&lt;br /&gt;
     return( out )&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;prediction MSE using all variables&lt;br /&gt;
 set.seed(123456)&lt;br /&gt;
 cv.out.lm = '''crossval::crossval'''(predfun.lm, x, y, K=5, B=20, negative=&amp;quot;1&amp;quot;)&lt;br /&gt;
 c(cv.out.lm$\$$stat, cv.out.lm$\$$stat.se) 			# 72.581198  3.736784&lt;br /&gt;
 &amp;amp;#35;reducing to using only two variables&lt;br /&gt;
 cv.out.lm = '''crossval::crossval'''(predfun.lm, x[,c(1,3)], y, K=5, B=20, negative=&amp;quot;1&amp;quot;)&lt;br /&gt;
 c(cv.out.lm$\$$stat, cv.out.lm$\$$stat.se)			# 52.563957  2.015109&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''(3) a real example using the ppmi_data'''&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;ppmi_data &amp;lt;-read.csv(&amp;quot;https://umich.instructure.com/files/330400/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
 &amp;amp;#35;ppmi_data$\$$ResearchGroup &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup == &amp;quot;Control&amp;quot;, &amp;quot;Control&amp;quot;, &amp;quot;Patient&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;attach(ppmi_data); head(ppmi_data)&lt;br /&gt;
 &amp;amp;#35;install.packages(&amp;quot;crossval&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;library(&amp;quot;crossval&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;ppmi_data$\$$PD &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup==&amp;quot;Control&amp;quot;,1,0)&lt;br /&gt;
 &amp;amp;#35;input &amp;lt;- ppmi_data[ ,-which(names(ppmi_data) %in% c(&amp;quot;ResearchGroup&amp;quot;,&amp;quot;PD&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;FID_IID&amp;quot;))]&lt;br /&gt;
 &amp;amp;#35;output &amp;lt;- as.factor(ppmi_data$\$$PD)&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;remove the irrelevant variables (e.g., visit ID)&lt;br /&gt;
 output &amp;lt;- as.factor(ppmi_data$\$$PD)&lt;br /&gt;
 input &amp;lt;- ppmi_data[, -which(names(ppmi_data) %in% c(&amp;quot;ResearchGroup&amp;quot;,&amp;quot;PD&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;FID_IID&amp;quot;, &amp;quot;VisitID&amp;quot;))]&lt;br /&gt;
 X = as.matrix(input)	# Predictor variables&lt;br /&gt;
 Y = as.matrix(output) 	#  Actual PD clinical assessment &lt;br /&gt;
 dim(X); dim(Y)&lt;br /&gt;
 &lt;br /&gt;
 layout(matrix(c(1,2,3,4),2,2)) 		# optional 4 graphs/page&lt;br /&gt;
 fit &amp;lt;- lm(Y~X); plot(fit)		# plot the fit &lt;br /&gt;
 levels(as.factor(Y)) 			# &amp;quot;0&amp;quot; &amp;quot;1&amp;quot;&lt;br /&gt;
 c(dim(X), dim(Y))			# 1043  103&lt;br /&gt;
 &lt;br /&gt;
 set.seed(12345)&lt;br /&gt;
 &amp;amp;#35;cv.out.lm = '''crossval::crossval'''(predfun.lm, as.data.frame(X), as.numeric(Y), K=5, B=20)&lt;br /&gt;
 &lt;br /&gt;
 cv.out.lda = crossval::crossval(predfun.lda, X, Y, K=5, B=20, negative=&amp;quot;1&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;K=Number of folds; &amp;lt;u&amp;gt;'''B=Number of repetitions.'''&amp;lt;/u&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;#35;Results&lt;br /&gt;
 &lt;br /&gt;
 cv.out.lda$\$$stat; cv.out.lda; diagnosticErrors(cv.out.lda$\$$stat)&lt;br /&gt;
 cv.out.lm$\$$stat; cv.out.lm; diagnosticErrors(cv.out.lm$\$$stat)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The cross-validation (CV) output object includes the following components:'''&lt;br /&gt;
&lt;br /&gt;
*stat.cv: ''Vector'' od statistics returned by predfun for each cross validation run&lt;br /&gt;
&lt;br /&gt;
*stat: ''Mean'' the statistic returned by predfun averaged over all cross validation runs&lt;br /&gt;
&lt;br /&gt;
*stat.se: ''Variability'': the corresponding standard error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|FP||TP||TN||FN &lt;br /&gt;
|-&lt;br /&gt;
|0.06||96.94||33.14||2.06 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|acc||&amp;lt;b&amp;gt;sens&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;spec&amp;lt;/b&amp;gt;||ppv||npv||lor &lt;br /&gt;
|-&lt;br /&gt;
|0.9839637||&amp;lt;b&amp;gt;0.9791919&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;0.9981928&amp;lt;/b&amp;gt;||0.9993814||0.9414773||10.1655380&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci_CrossVal4.png|500px]]&lt;br /&gt;
&lt;br /&gt;
====Alternative predictor functions====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Logistic Regression&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(See the earlier batch of class notes, https://umich.instructure.com/files/421847/download?download_frd=1)&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;#35;ppmi_data &amp;lt;-&lt;br /&gt;
 read.csv(&amp;quot;https://umich.instructure.com/files/330400/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
 &amp;amp;#35; ppmi_data$\$$ResearchGroup &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup == &amp;quot;Control&amp;quot;, &amp;quot;Control&amp;quot;, &amp;quot;Patient&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;install.packages(&amp;quot;crossval&amp;quot;); library(&amp;quot;crossval&amp;quot;)&lt;br /&gt;
 &amp;amp;#35;ppmi_data$\$$PD &amp;lt;- ifelse(ppmi_data$\$$ResearchGroup==&amp;quot;Control&amp;quot;,1,0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;remove the irrelevant variables (e.g., visit ID)&lt;br /&gt;
&lt;br /&gt;
 output &amp;lt;- as.factor(ppmi_data$\$$PD)&lt;br /&gt;
 input &amp;lt;- ppmi_data[, -which(names(ppmi_data) %in% c(&amp;quot;ResearchGroup&amp;quot;,&amp;quot;PD&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;FID_IID&amp;quot;, &amp;quot;VisitID&amp;quot;))]&lt;br /&gt;
 X = as.matrix(input)	# Predictor variables&lt;br /&gt;
 Y = as.matrix(output)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;'''Note that the predicted values are in LOG terms, so we need to exponentiate them to interpret them correctly'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 lm.logit &amp;lt;- glm(as.numeric(Y) ~ ., data = as.data.frame(X), family = &amp;quot;binomial&amp;quot;)&lt;br /&gt;
 ynew &amp;lt;- predict(lm.logit, as.data.frame(X)); plot(ynew)&lt;br /&gt;
 ynew2 &amp;lt;- ifelse(exp(ynew)&amp;lt;0.5, 0, 1); plot(ynew2)&lt;br /&gt;
 &lt;br /&gt;
 '''predfun.logit = function(train.x, train.y, test.x, test.y, neg)'''&lt;br /&gt;
 {      lm.logit &amp;lt;- glm(train.y ~ ., data = train.x, family = &amp;quot;binomial&amp;quot;)&lt;br /&gt;
        ynew = predict(lm.logit, test.x )&lt;br /&gt;
        &amp;amp;#35;compute TP, FP, TN, FN&lt;br /&gt;
        &amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;ynew2&amp;lt;/span&amp;gt; &amp;lt;- ifelse(exp(ynew)&amp;lt;0.5, 0, 1)&lt;br /&gt;
        out = confusionMatrix(test.y, ynew2, negative=neg)	# Binary outcome, we can use confusionMatrix&lt;br /&gt;
        return( out )&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#35;Reduce the bag of explanatory variables, purely to simplify the interpretation of the analytics in this example!&lt;br /&gt;
&lt;br /&gt;
 input.short &amp;lt;- input[, which(names(input) %in% c(&amp;quot;R_fusiform_gyrus_Volume&amp;quot;,&lt;br /&gt;
        &amp;quot;R_fusiform_gyrus_ShapeIndex&amp;quot;, &amp;quot;R_fusiform_gyrus_Curvedness&amp;quot;,&lt;br /&gt;
        &amp;quot;Sex&amp;quot;,  &amp;quot;Weight&amp;quot;, &amp;quot;Age&amp;quot; , &amp;quot;chr12_rs34637584_GT&amp;quot;, &amp;quot;chr17_rs11868035_GT&amp;quot;,  &lt;br /&gt;
        &amp;quot;UPDRS_Part_I_Summary_Score_Baseline&amp;quot;, &amp;quot;UPDRS_Part_I_Summary_Score_Month_03&amp;quot;, &lt;br /&gt;
        &amp;quot;UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline&amp;quot;, &lt;br /&gt;
        &amp;quot;UPDRS_Part_III_Summary_Score_Baseline&amp;quot;,&lt;br /&gt;
        &amp;quot;X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline&amp;quot;     &lt;br /&gt;
   ))]&lt;br /&gt;
 X = as.matrix(input.short)&lt;br /&gt;
&lt;br /&gt;
 cv.out.logit = '''crossval::crossval'''(predfun.logit, as.data.frame(X), as.numeric(Y), K=5, B=2, neg=&amp;quot;1&amp;quot;)&lt;br /&gt;
 cv.out.logit$\$$stat.cv&lt;br /&gt;
 diagnosticErrors(cv.out.logit$\$$stat)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;Caution:&amp;lt;/span&amp;gt; Note that if you forget to exponentiate the predicted logistic model values (see ynew2 in predict.logit), you will get nonsense results (e.g., all cases are predicted to be in one class, trivial sensitivity or NPP).&lt;br /&gt;
&lt;br /&gt;
 predfun.qda = function(train.x, train.y, test.x, test.y, negative)&lt;br /&gt;
 {&lt;br /&gt;
     require(&amp;quot;MASS&amp;quot;) # for lda function&lt;br /&gt;
     qda.fit = qda(train.x, grouping=train.y)&lt;br /&gt;
     ynew = predict(qda.fit,test.x)$\$$class&lt;br /&gt;
     out.qda = confusionMatrix(test.y, ynew, negative=negative)&lt;br /&gt;
     return( out.qda )&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;mark&amp;gt;cv.out.qda = '''crossval::crossval'''(predfun.qda,&amp;lt;/mark&amp;gt; as.data.frame(input.short),   &amp;lt;mark&amp;gt;as.factor(Y), K=5, B=20, neg=&amp;quot;1&amp;quot;)&amp;lt;/mark&amp;gt;&lt;br /&gt;
 diagnosticErrors(cv.out.lda$\$$stat); diagnosticErrors(cv.out.qda$\$$stat);&lt;br /&gt;
&lt;br /&gt;
This error message: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;“Error in qda.default(x, grouping, ...) : rank deficiency in group 1”&amp;lt;/font&amp;gt; indicates that there is a rank deficiency, i.e. some variables are collinear and one or more covariance matrices cannot be inverted to obtain the estimates in group 1 (Controls)!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;If you remove the strongly correlated data elements (&amp;quot;R_fusiform_gyrus_Volume&amp;quot;,&amp;quot;R_fusiform_gyrus_ShapeIndex&amp;quot;, and &amp;quot;R_fusiform_gyrus_Curvedness&amp;quot;), the rank-deficiency problem goes away!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 input.short2 &amp;lt;- input[, which(names(input) %in%)&amp;quot;R_fusiform_gyrus_Volume&amp;quot;, &lt;br /&gt;
        &amp;quot;Sex&amp;quot;,  &amp;quot;Weight&amp;quot;, &amp;quot;Age&amp;quot; , &amp;quot;chr17_rs11868035_GT&amp;quot;,                                             &lt;br /&gt;
        &amp;quot;UPDRS_Part_I_Summary_Score_Baseline&amp;quot;,&lt;br /&gt;
        &amp;quot;UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline&amp;quot;,                        &lt;br /&gt;
        &amp;quot;UPDRS_Part_III_Summary_Score_Baseline&amp;quot;,                                             &lt;br /&gt;
        &amp;quot;X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline&amp;quot;    &lt;br /&gt;
     ))]&lt;br /&gt;
 X = as.matrix(input.short2)&lt;br /&gt;
 cv.out.qda = crossval::crossval(predfun.qda, as.data.frame(X), as.numeric(Y), K=5, B=2, neg=&amp;quot;1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color: #32cd32&amp;quot;&amp;gt;Compare the QDA and GLM/Logit  predictions:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 diagnosticErrors(cv.out.qda$\$$stat); diagnosticErrors(cv.out.logit$\$$stat)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;http://www.ohrt.com/odds/binomial.php&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci_CrossVal_LDA_QDA| Next Section: Foundation of LDA and QDA for prediction, dimensionality reduction or forecasting]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Growth Curve Modeling (GCM)]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
* [[SMHS_BigDataBigSci|Back to Big Data Science]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_CrossVal}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM&amp;diff=16246</id>
		<title>SMHS BigDataBigSci SEM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM&amp;diff=16246"/>
		<updated>2016-05-24T14:07:27Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Structural Equation Modeling (SEM) ==&lt;br /&gt;
&lt;br /&gt;
SEM allow re-parameterization of random-effects to specify latent variables that may affect measures at different time points using structural equations. SEM show variables having predictive (possibly causal) effects on other variables (denoted by arrows) where coefficients index the strength and direction of predictive relations. SEM does not offer much more than what classical regression methods do, but it does allow simultaneous estimation of multiple equations modeling complementary relations. &lt;br /&gt;
&lt;br /&gt;
SEM is a general multivariate statistical analysis technique that can be used for causal modeling/inference, path analysis, confirmatory factor analysis (CFA), covariance structure modeling, and correlation structure modeling.&lt;br /&gt;
&lt;br /&gt;
===SEM Advantages===&lt;br /&gt;
* It allows testing models with multiple dependent variables&lt;br /&gt;
* Provides mechanisms for modeling mediating variables&lt;br /&gt;
* Enables modeling of error terms&lt;br /&gt;
* acilitates modeling of challenging data  (longitudinal with auto-correlated errors, multi-level data, non-normal data, incomplete data)&lt;br /&gt;
&lt;br /&gt;
SEM allows separation of observed and latent variables. Other standard statistical procedures may be viewed as special cases of SEM, where statistical significance less important, than in other techniques, and covariances are the core of structural equation models.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
*The &amp;lt;b&amp;gt;disturbance&amp;lt;/b&amp;gt;, &amp;lt;i&amp;gt;D&amp;lt;/i&amp;gt;, is the variance in Y unexplained by a variable X that is assumed to affect Y.&lt;br /&gt;
 X    →    Y   ←     D&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Measurement error&amp;lt;/b&amp;gt;, &amp;lt;i&amp;gt;E&amp;lt;/i&amp;gt;, is the variance in X unexplained by A, where X is an observed variable that is presumed to measure a latent variable, &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt;.&lt;br /&gt;
 A    →    X   ←     E&lt;br /&gt;
&lt;br /&gt;
* Categorical variables in a model are &amp;lt;b&amp;gt;exogenous&amp;lt;/b&amp;gt; (independent) or &amp;lt;b&amp;gt;endogenous&amp;lt;/b&amp;gt; (dependent).&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
&lt;br /&gt;
* In SEM &amp;lt;b&amp;gt;observed (or manifest) indicators&amp;lt;/b&amp;gt; are represented by &amp;lt;b&amp;gt;squares/rectangles&amp;lt;/b&amp;gt; whereas latent variables (or factors) represented by circles/ovals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci1.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''Relations: Direct effects''' (&amp;amp;rarr;), '''Reciprocal effects''' (&amp;amp;harr; or &amp;amp;#8646;), and '''Correlation or covariance''' (&amp;amp;#x293B; or &amp;amp;#x293A;) all have different appearance in SEM models.&lt;br /&gt;
&lt;br /&gt;
===Model Components===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;measurement part&amp;lt;/b&amp;gt; of SEM model deals with the latent variables and their indicators. A pure measurement model is a confirmatory factor analysis (CFA) model with unmeasured covariance (bidirectional arrows) between each possible pair of latent variables. There are &amp;lt;u&amp;gt;straight arrows from the latent variables to their respective indicators and straight arrows from the error and disturbance terms to their respective variables, but no direct effects (straight arrows) connecting the latent variables&amp;lt;/u&amp;gt;. The &amp;lt;b&amp;gt;measurement model&amp;lt;/b&amp;gt; is evaluated using goodness of fit measures (Chi-Square test, BIC, AIC, etc.) &amp;lt;b&amp;gt;Validation of the measurement model is always first.&amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Then we proceed to the structural model&amp;lt;/b&amp;gt; (including a set of exogenous and endogenous variables together with the direct effects (straight arrows) connecting them along with the disturbance and error terms for these variables that reflect the effects of unmeasured variables not in the model).&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* Sample-size considerations: mostly same as for regression - more is always better.&lt;br /&gt;
* Model assessment strategies: Chi-square test, Comparative Fit Index, Root Mean Square Error, Tucker Lewis Index, Goodness of Fit Index, AIC, and BIC.&amp;gt;&lt;br /&gt;
* Choice for number of Indicator variables: depends on pilot data analyses, a priori concerns, fewer is better.&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM_Ex1|Hands-on Example 1 (School Kids Mental Abilities)]]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM_Ex2|Hands-on Example 2 (Parkinson’s Disease data)]]===&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Next Section: Growth Curve Modeling]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_GCM| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci&amp;diff=16245</id>
		<title>SMHS BigDataBigSci</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci&amp;diff=16245"/>
		<updated>2016-05-24T13:57:39Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /*  Generalized Estimating Equation (GEE) Modeling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS| Scientific Methods for Health Sciences]] - Model-based Analyses ==&lt;br /&gt;
&lt;br /&gt;
Structural Equation Modeling (SEM), Growth Curve Models (GCM), and Generalized Estimating Equation (GEE) Modeling&lt;br /&gt;
&lt;br /&gt;
==Questions ==&lt;br /&gt;
&lt;br /&gt;
*How to represent dependencies in linear models and examine causal effects?&lt;br /&gt;
*Is there a way to study population average effects of a covariate against specific individual effects?&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
SEM allow re-parameterization of random-effects to specify latent variables that may affect measures at different time points using structural equations. SEM show variables having predictive (possibly causal) effects on other variables (denoted by arrows) where coefficients index the strength and direction of predictive relations. SEM does not offer much more than what classical regression methods do, but it does allow simultaneous estimation of multiple equations modeling complementary relations. &lt;br /&gt;
&lt;br /&gt;
Growth Curve (or latent growth) modeling is a statistical technique employed in SEM for estimating growth trajectories for longitudinal data (over time). It represent repeated measures of dependent variables as functions of time and other covariates. When subjects or units are observed repeatedly over known time points latent growth curve models reveal the trend of an individual as a function of an underlying growth process where the growth curve parameters can be estimated for each subject/unit.&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
For instance, suppose $Y_{i,j}$ is the random effects &amp;lt;b&amp;gt;logistic model&amp;lt;/b&amp;gt; of the $j^{th}$,  observation of the $i^{th}$ subject, then &lt;br /&gt;
$&lt;br /&gt;
log\Bigg(\frac{p_{i,j}}{1-p_{i,j}} \Bigg)=μ+ν_i,&lt;br /&gt;
$&lt;br /&gt;
where  $ν_i \sim N(0,σ^2)$ is a random effect for &amp;lt;u&amp;gt;subject i&amp;lt;/u&amp;gt; and $p_{i,j}=P(Y_{i,j}=1|ν_i).$&lt;br /&gt;
&lt;br /&gt;
(1) When using a random effects model on such data, the estimate of μ accounts for the fact that a mean zero normally distributed perturbation was applied to each individual, making it ''individual-specific''.&lt;br /&gt;
&lt;br /&gt;
(2) When using a GEE model on the same data, we estimate the &amp;lt;i&amp;gt;population average log odds&amp;lt;/i&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
\begin{equation}&lt;br /&gt;
δ=log\Bigg(\frac{E_v(\frac{1}{1+e^{-μ+v}i})}{1-E_v(\frac{1}{1+e^{-μ+v}i})}&lt;br /&gt;
\Bigg),&lt;br /&gt;
\end{equation} &lt;br /&gt;
&lt;br /&gt;
in general $μ≠δ$.&lt;br /&gt;
&lt;br /&gt;
If $μ=1$ and $σ^2=1$, then $δ≈.83$. &lt;br /&gt;
&lt;br /&gt;
empirically:&lt;br /&gt;
&lt;br /&gt;
m &amp;lt;- 1; s &amp;lt;- 1; v&amp;lt;-rnorm(1000, 0,s); v2 &amp;lt;- 1/(1+exp(-m+v)); v_mean &amp;lt;- mean(v2)&lt;br /&gt;
&lt;br /&gt;
d &amp;lt;- log(v_mean/(1-v_mean)); d&lt;br /&gt;
&lt;br /&gt;
Note that the random effects have mean zero on the transformed, linked, scale, but their effect is not mean zero on the original scale of the data. We can also simulate data from a mixed effects logistic regression model and compare the population level average with the inverse-logit of the intercept to see that they are not equal. This leads to a difference of the interpretation of the coefficients between GEE and random effects models, or SEM.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;That is, there will be a difference between the GEE population average coefficients and the individual specific coefficients (random effects models).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;# theoretically&amp;lt;/b&amp;gt;, if it can be computed:&lt;br /&gt;
&lt;br /&gt;
$E(Y)=μ=1$ (in this specific case), but the expectation of the population average log odds &lt;br /&gt;
$δ=log\Bigg[\frac{P(Y_{i,j}=1|v_i)}{1-P(Y_{i,j}=1|v_i)}\Bigg]$  would be $&amp;lt; 1$ &amp;lt;SUP&amp;gt;1&amp;lt;/SUP&amp;gt;. &lt;br /&gt;
Note that this is kind of related to the fact that a grand-total average  need not be equal to an average of partial averages. &lt;br /&gt;
&lt;br /&gt;
The mean of the $i^{th}$ person in the $j^{th}$ observation (e.g., location, time, etc.) can be expressed by:&lt;br /&gt;
&lt;br /&gt;
$E(Yij | Xij,α_j)= g[μ(Xij|β)+Uij(α_j,Xij)]$,&lt;br /&gt;
&lt;br /&gt;
Where $μ(X_{ij}|β)$ is the average “response” of a person with the same covariates $X_{ij}$, $β$ a set of fixed effect coefficients, and $Uij(α_j,Xij)$ is an error term that is a function of the (time, space) random effects, $α_j$, and also a  function of the covariates $X_{ij}$, and $g$ is the '''link function''' which specifies the regression type -- e.g., &lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;u&amp;gt;linear&amp;lt;/u&amp;gt;:''' 		$g^{-1} (u)=u,$&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;u&amp;gt;log&amp;lt;/u&amp;gt;:'''		        $g^{-1} (u)= log(u),$ &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;u&amp;gt;logistic&amp;lt;/u&amp;gt;:''' 		$g^{-1} (u)=log(\frac{u}{1-u})$&lt;br /&gt;
 &lt;br /&gt;
*$E(Uij(α_j,Xij)|Xij)=0.$&lt;br /&gt;
&lt;br /&gt;
The link function, $g(u)$, provides the relationship between the linear predictor and the mean of the distribution function. For practical applications there are many commonly used link functions. It makes sense to try to match the domain of the link function to the range of the distribution function's mean.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Common distributions with typical uses and canonical link functions&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Distribution&amp;lt;/b&amp;gt; ||&amp;lt;b&amp;gt;Support of distribution&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Typical uses&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Link name&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Link function&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Mean function&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Normal||real: $(-&amp;amp;#8734;, +&amp;amp;#8734;)$||Linear-response data||Identity||$X\beta=\mu$||$\mu=X\beta$&lt;br /&gt;
|-&lt;br /&gt;
|Exponential, Gamma||real:$(0, +&amp;amp;#8734;)$||Exponential-response data, scale parameters||Inverse||$X\beta=-\mu^{-1}$||$\mu=-(X\beta)^{-1}$&lt;br /&gt;
|-&lt;br /&gt;
|Inverse Gaussian||real:$(0, +&amp;amp;#8734;)$|| ||Inverse squared||$X\beta=-\mu^{-2}$||$\mu=(-X\beta)^{-1/2}$ &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://www.researchgate.net/publication/41895248&lt;br /&gt;
&lt;br /&gt;
==Model-based Analytics==&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_GCM| Growth Curve Modeling (GCM)]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_GCM| Generalized Estimating Equation (GEE) Modeling]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_CrossVal|Internal Validation - Statistical n-fold cross-validaiton]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16244</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16244"/>
		<updated>2016-05-23T20:00:01Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.imachordata.com/ecological-sems-and-composite-variables-what-why-and-how/&lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16243</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16243"/>
		<updated>2016-05-23T19:58:06Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /*  Model-based Analytics - Growth Curve Models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.imachordata.com/ecological-sems-and-composite-variables-what-why-and-how/&lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GEE| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16242</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16242"/>
		<updated>2016-05-23T19:52:39Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16241</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16241"/>
		<updated>2016-05-23T19:50:18Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==See also==&lt;br /&gt;
*[[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
*[[SMHS_BigDataBigSci_GCM| Back to Growth Curve Modeling ]]&lt;br /&gt;
*[[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16240</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16240"/>
		<updated>2016-05-23T19:49:33Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
*[[SMHS_BigDataBigSci_GCM| Back to Growth Curve Modeling ]]&lt;br /&gt;
*[[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16239</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16239"/>
		<updated>2016-05-23T19:49:27Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /*  Model-based Analytics - Generalized Estimating Equation (GEE) Modeling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Questions==&lt;br /&gt;
&lt;br /&gt;
*How to represent dependencies in linear models and examine causal effects?&lt;br /&gt;
*Is there a way to study population average effects of a covariate against specific individual effects?&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
*[[SMHS_BigDataBigSci_GCM| Back to Growth Curve Modeling ]]&lt;br /&gt;
*[[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16238</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16238"/>
		<updated>2016-05-23T19:47:11Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Generalized Estimating Equation (GEE) Modeling ==&lt;br /&gt;
&lt;br /&gt;
==Questions==&lt;br /&gt;
&lt;br /&gt;
*How to represent dependencies in linear models and examine causal effects?&lt;br /&gt;
*Is there a way to study population average effects of a covariate against specific individual effects?&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
*[[SMHS_BigDataBigSci_GCM| Back to Growth Curve Modeling ]]&lt;br /&gt;
*[[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16237</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16237"/>
		<updated>2016-05-23T19:43:57Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.imachordata.com/ecological-sems-and-composite-variables-what-why-and-how/&lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GEE| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16236</id>
		<title>SMHS BigDataBigSci GEE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE&amp;diff=16236"/>
		<updated>2016-05-23T19:19:44Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Generalized Estimating Equation (GEE) Modeling ==&lt;br /&gt;
&lt;br /&gt;
==Questions==&lt;br /&gt;
&lt;br /&gt;
*How to represent dependencies in linear models and examine causal effects?&lt;br /&gt;
*Is there a way to study population average effects of a covariate against specific individual effects?&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
*[[SMHS_BigDataBigSci_GCM| Back to Growth Curve Modeling ]]&lt;br /&gt;
*[[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GEE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16235</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16235"/>
		<updated>2016-05-23T19:14:35Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.imachordata.com/ecological-sems-and-composite-variables-what-why-and-how/&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GEE| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16234</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16234"/>
		<updated>2016-05-23T19:14:10Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.imachordata.com/ecological-sems-and-composite-variables-what-why-and-how/&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GEE| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16233</id>
		<title>SMHS BigDataBigSci GCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM&amp;diff=16233"/>
		<updated>2016-05-23T19:12:55Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Comparative Fit Index */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci| Model-based Analytics]] - Growth Curve Models==&lt;br /&gt;
&lt;br /&gt;
Latent growth curve models may be used to analyze longitudinal or temporal data where the outcome measure is assessed on multiple occasions, and we examine its change over time, e.g., the trajectory over time can be&lt;br /&gt;
modeled as a linear or quadratic function.  Random effects are used to capture individual differences by conveniently representing (continuous) latent variables, aka growth factors.  To fit a linear growth model we may specify a model with two latent variables:  a random intercept, and a random slope:&lt;br /&gt;
&lt;br /&gt;
 #load data   &amp;lt;b&amp;gt;05_PPMI_top_UPDRS_Integrated_LongFormat.csv ( dim(myData) 661  71), wide&amp;lt;/b&amp;gt; &lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330395/download?download_frd=1&amp;amp;verifier=v6jBvV4x94ka3EYcGKuXXg5BZNaOLBVp0xkJih0H&amp;quot;,header=TRUE)&lt;br /&gt;
 attach(myData)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 table(myData$\$$ResearchGroup)&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # linear growth model with 4 timepoints&lt;br /&gt;
 # intercept (i) and slope (s) with fixed coefficients&lt;br /&gt;
 # i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 (intercept/constant)&lt;br /&gt;
 # s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (slope/linear term)&lt;br /&gt;
 # ??? =~ 0*t1 + 1*t2 + 2*t3 + 3*t4  (quadratic term)&lt;br /&gt;
&lt;br /&gt;
In this model, we have fixed all the coefficients of the linear growth functions:&lt;br /&gt;
&lt;br /&gt;
 model4 &amp;lt;-&lt;br /&gt;
 ' &lt;br /&gt;
 i =~ 1*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_06 + 1*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_12 + 1*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_I_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +&lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_06 + 1*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_12 + 1*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 1*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 +&lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 1*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24 &lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_I_Summary_Score_Month_06 + 3*UPDRS_Part_I_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_I_Summary_Score_Month_12 + 5*UPDRS_Part_I_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_I_Summary_Score_Month_24 +&lt;br /&gt;
 0*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline + &lt;br /&gt;
 1*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06 + &lt;br /&gt;
 3*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12 + &lt;br /&gt;
 5*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18 +         &lt;br /&gt;
 6*UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24 + &lt;br /&gt;
 0*UPDRS_Part_III_Summary_Score_Baseline + 1*UPDRS_Part_III_Summary_Score_Month_03 + &lt;br /&gt;
 2*UPDRS_Part_III_Summary_Score_Month_06 + 3*UPDRS_Part_III_Summary_Score_Month_09 + &lt;br /&gt;
 4*UPDRS_Part_III_Summary_Score_Month_12 + 5*UPDRS_Part_III_Summary_Score_Month_18 + &lt;br /&gt;
 6*UPDRS_Part_III_Summary_Score_Month_24 + &lt;br /&gt;
 0*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12 +&lt;br /&gt;
 6*X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24 +&lt;br /&gt;
 0*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline + &lt;br /&gt;
 2*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06 + &lt;br /&gt;
 4*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12 + &lt;br /&gt;
 6*X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit4 &amp;lt;- growth(model4, data=myData)&lt;br /&gt;
 summary(fit4)&lt;br /&gt;
 parameterEstimates(fit4)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame	&lt;br /&gt;
 fitted(fit4)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit4)&lt;br /&gt;
&lt;br /&gt;
==Measures of model quality (Comparative Fit Index (CFI), Root Mean Square Error of Approximation (RMSEA))==&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector: Comparative Fit Index (CFI), Root Mean Square Error of &lt;br /&gt;
 # Approximation (RMSEA)&lt;br /&gt;
 fitMeasures(fit4, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
====Comparative Fit Index====&lt;br /&gt;
&lt;br /&gt;
(CFI) is an incremental measure directly based on the non-centrality measure.  If d = χ2(df) where df are the degrees of freedom of the model, the Comparative Fit Index is:&lt;br /&gt;
$&lt;br /&gt;
\frac{(Null Model)-d(Proposed Model)}{d(Null Model)}.&lt;br /&gt;
$&lt;br /&gt;
&lt;br /&gt;
$0≤CFI≤1$ (by definition). It is interpreted as:&lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;lt;0.9$  - model fitting is poor.&lt;br /&gt;
&lt;br /&gt;
*$0.9≤CFI≤0.95$  is considered marginal, &lt;br /&gt;
&lt;br /&gt;
*$CFI&amp;gt;0.95$   is good. &lt;br /&gt;
&lt;br /&gt;
CFI is a relative index of model fit – it compare the fit of your model to the fit of (the worst) fitting null model.&lt;br /&gt;
&lt;br /&gt;
====Root Mean Square Error of Approximation====&lt;br /&gt;
(RMSEA) - “Ramsey”&lt;br /&gt;
&lt;br /&gt;
An absolute measure of fit based on the non-centrality parameter: &lt;br /&gt;
&lt;br /&gt;
$\sqrt{\frac{X^2-df}{df×(N - 1)}}$,&lt;br /&gt;
&lt;br /&gt;
where N the sample size and df the degrees of freedom of the model.  If χ&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  &amp;lt; df, then the RMSEA∶=0.  It has a penalty for complexity via the chi square to df ratio.  The RMSEA is a popular measure of model fit. &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;lt; 0.01, excellent, &lt;br /&gt;
&lt;br /&gt;
*RMSEA  &amp;lt; 0.05, good &lt;br /&gt;
&lt;br /&gt;
*RMSEA &amp;gt; 0.10 cutoff for poor fitting models&lt;br /&gt;
&lt;br /&gt;
====Standardized Root Mean Square Residual==== &lt;br /&gt;
(SRMR) is an absolute measure of fit defined as the standardized difference between the observed correlation and the predicted correlation.  A value of zero indicates perfect fit.  The SRMR has no penalty for model complexity.  SRMR &amp;lt;0.08 is considered a good fit.&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit4)&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
 # library(&amp;quot;semTools&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A Simpler Model (fit5)&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 model5 &amp;lt;- '&lt;br /&gt;
  # intercept and slope with fixed coefficients&lt;br /&gt;
 i =~ UPDRS_Part_I_Summary_Score_Baseline + UPDRS_Part_I_Summary_Score_Month_03 + UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 s =~ 0*UPDRS_Part_I_Summary_Score_Baseline + 1*UPDRS_Part_I_Summary_Score_Month_03 + 6*UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
  # regressions&lt;br /&gt;
 i ~  R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT                                                              &lt;br /&gt;
 s ~ R_fusiform_gyrus_Volume + Weight + ResearchGroup + Age + chr12_rs34637584_GT&lt;br /&gt;
  # time-varying covariates&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Baseline ~ Weight&lt;br /&gt;
    UPDRS_Part_I_Summary_Score_Month_03  ~ ResearchGroup &lt;br /&gt;
     UPDRS_Part_I_Summary_Score_Month_24 ~ Age&lt;br /&gt;
 '&lt;br /&gt;
&lt;br /&gt;
 fit5 &amp;lt;- growth(model5, data=myData)&lt;br /&gt;
 summary(fit5); fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))&lt;br /&gt;
 parameterEstimates(fit5)	# extracts the values of the estimated parameters, the standard errors, &lt;br /&gt;
 # the z-values, the standardized parameter values, and returns a data frame&lt;br /&gt;
&lt;br /&gt;
 lavaan (0.5-18) converged normally after  99 iterations&lt;br /&gt;
  Number of observations                           661&lt;br /&gt;
  Estimator                                         ML&lt;br /&gt;
  Minimum Function Test Statistic                3.703&lt;br /&gt;
  Degrees of freedom                                 1&lt;br /&gt;
  P-value (Chi-square)                           0.054&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
  Information                                 Expected&lt;br /&gt;
  Standard Errors                             Standard&lt;br /&gt;
                    Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
 Latent variables:&lt;br /&gt;
  i =~&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.074&lt;br /&gt;
    UPDRS_P_I_S_S     1.172&lt;br /&gt;
  s =~&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     1.000&lt;br /&gt;
    UPDRS_P_I_S_S     6.000&lt;br /&gt;
 &lt;br /&gt;
 Regressions:&lt;br /&gt;
  i ~&lt;br /&gt;
    R_fsfrm_gyr_V     0.000&lt;br /&gt;
    Weight            0.003&lt;br /&gt;
    ResearchGroup    -0.880&lt;br /&gt;
    Age              -0.009&lt;br /&gt;
    c12_34637584_    -0.907&lt;br /&gt;
  s ~&lt;br /&gt;
    R_fsfrm_gyr_V    -0.000&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
    ResearchGroup    -0.084&lt;br /&gt;
    Age               0.002&lt;br /&gt;
    c12_34637584_    -0.047&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Baseline ~&lt;br /&gt;
    Weight           -0.000&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_03 ~&lt;br /&gt;
    ResearchGroup     0.693&lt;br /&gt;
  UPDRS_Part_I_Summary_Score_Month_24 ~&lt;br /&gt;
    Age              -0.002&lt;br /&gt;
 &lt;br /&gt;
 Covariances:&lt;br /&gt;
  i ~~&lt;br /&gt;
    s                 0.074&lt;br /&gt;
 &lt;br /&gt;
 Intercepts:&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    UPDRS_P_I_S_S     0.000&lt;br /&gt;
    i                 1.633&lt;br /&gt;
    s                -0.023&lt;br /&gt;
 &lt;br /&gt;
 Variances:&lt;br /&gt;
    UPDRS_P_I_S_S     1.017&lt;br /&gt;
    UPDRS_P_I_S_S     1.093&lt;br /&gt;
    UPDRS_P_I_S_S     2.993&lt;br /&gt;
    i                 1.019&lt;br /&gt;
    s                -0.025&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;b&amp;gt;cfi rmsea  srmr&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;0.996 0.064 0.008&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 fitted(fit5)	# return the model-implied (fitted) covariance matrix (and mean vector) of a fitted model&lt;br /&gt;
 # write.table(fitted(fit5), file=&amp;quot;C:\\Users\\Dinov\\Desktop\\test1.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # resid() function return (unstandardized) residuals of a fitted model including the difference between &lt;br /&gt;
 # the observed and implied covariance matrix and mean vector&lt;br /&gt;
 resid(fit5)&lt;br /&gt;
&lt;br /&gt;
 # report the fit measures as a signature vector&lt;br /&gt;
 fitMeasures(fit5, c(&amp;quot;cfi&amp;quot;, &amp;quot;rmsea&amp;quot;, &amp;quot;srmr&amp;quot;))   # comparative fit index (CFI)&lt;br /&gt;
&lt;br /&gt;
 # inspect the model results (report parameter table)&lt;br /&gt;
 inspect(fit5)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; See discussion of SEM modeling pros/cons &amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Generalized Estimating Equation (GEE) Modeling==&lt;br /&gt;
&lt;br /&gt;
Generalized Estimating Equations (GEE) modeling&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; is used for analyzing data with the following characteristics:&lt;br /&gt;
(1) the observations within a group may be correlated, (2) observations in separate clusters are independent, (3) a monotone transformation of the expectation is linearly related to the explanatory variables, and (4) the variance is a function of the expectation. The expectation (#3) and the variance (# 4) are conditional given group-level or individual-level covariates.&lt;br /&gt;
&lt;br /&gt;
GEE is applied to handle correlated discrete and continuous outcome variables. For the outcome variables, it only requires specification   of the first 2 moments and   correlation   among   them.    The   goal   is   to estimate fixed parameters    without    specifying    their    joint    distribution.  The correlation is specified by one of these 4 alternatives (which is specified in the R call: geeglm(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, &amp;lt;b&amp;gt;corstr = &amp;quot; exchangeable&amp;quot;&amp;lt;/b&amp;gt;, scale.fix = TRUE):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci8.png|300px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Respiratory Illness GEE R example===&lt;br /&gt;
&lt;br /&gt;
This example is based on a data set on respiratory illness &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; and the &amp;lt;b&amp;gt;geepack&amp;lt;/b&amp;gt; package. The data is from a clinical study of the treatment effects on patients with respiratory illness. N=111 patients from 2 clinical centers randomized to receive either placebo or active treatments. 4 temporal examinations assessed the &amp;lt;b&amp;gt;respiratory state&amp;lt;/b&amp;gt; of patients as good (=1) or poor (=0). Explanatory variables characterizing a patient were: &amp;lt;b&amp;gt;center&amp;lt;/b&amp;gt; (1,2), treatment (A=active, P=placebo), &amp;lt;b&amp;gt;sex&amp;lt;/b&amp;gt; (M=male, F=female), &amp;lt;b&amp;gt;age&amp;lt;/b&amp;gt; (in years) at baseline. The values of the covariates were constant for the repeated elementary observations on each patient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt; shows the number of patients for the response patterns across the 4 visits split by baseline-status and treatment. Baseline respiratory status = 0 appear to have either low or high number of positive responses. Baseline respiratory status = 1 tend to respond positively. &amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt; describes the distribution of the number of positive responses per patient for sex and center.&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 1&amp;lt;/b&amp;gt;: Distribution of patients for &amp;lt;b&amp;gt;different response patterns&amp;lt;/b&amp;gt; classified by &amp;lt;b&amp;gt;baseline-respiratory&amp;lt;/b&amp;gt; response and &amp;lt;b&amp;gt;treatment&amp;lt;/b&amp;gt;. The patterns are ordered according to increasing numbers of positive responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ||Visit|| colspan=&amp;quot;15&amp;quot;| All Possible Response Patterns (2*2*2*2=16 permutation patterns)||&lt;br /&gt;
|-&lt;br /&gt;
|||1||0||1||0||0||0||1||1||1||0||0||1||1||1||0||1||&lt;br /&gt;
|-&lt;br /&gt;
|||2||0||0||1||0||0||1||0||0||1||0||1||1||0||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||3||0||0||0||1||0||0||1||0||1||1||1||0||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
|||4||0||0||0||0||1||0||0||1||0||1||0||1||1||1||1||&lt;br /&gt;
|-&lt;br /&gt;
!Baseline||Treatment||||||||||||||||||||||||||||||||Sum&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot;|0||A||7||2||2||2||1||0||1||0||1||0||1||2||0||4||7||30&lt;br /&gt;
|-&lt;br /&gt;
|P||18||1||0||2||1||2||0||0||1||0||0||1||2||0||3||31&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|1||A||0||0||0||0||0||0||1||1||0||0||4||0||1||0||17||24&lt;br /&gt;
|-&lt;br /&gt;
|P||1||4||1||0||0||0||0||1||1||3||1||1||2||1||10||26&lt;br /&gt;
|-&lt;br /&gt;
|Sum||||26||7||3||4||2||2||2||2||3||3||6||4||5||5||37||111&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 2&amp;lt;/b&amp;gt;: Distribution of patients for the number of positive responses across the 4 visits for &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Center&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; rowspan=&amp;quot;2&amp;quot;| ||colspan=&amp;quot;5&amp;quot;|Number of positive responses&lt;br /&gt;
|-&lt;br /&gt;
| 0||1||2||3||4&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Sex || F||7||3||3||3||7&lt;br /&gt;
|-&lt;br /&gt;
|M||19||13||9||17||30&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|Center|| 1||18||9||6||11||12&lt;br /&gt;
|-&lt;br /&gt;
|2||8||7||6||9||25&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Figure 1&amp;lt;/b&amp;gt; shows a plot of age against the proportion of positive responses for each patient. It indicates a quadratic relationship between the proportions and the age. Fitting a logistic model to the data (which would be appropriate if there were &amp;lt;i&amp;gt;no time effects&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;no spread in the response probabilities&amp;lt;/i&amp;gt; for patients with the same covariate values).&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
 library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # data include a clinical trial of 111 patients with respiratory illness from two different clinics were randomized to receive either &lt;br /&gt;
 # placebo (P) or an active (A) treatment. Patients were examined at baseline and at four visits during treatment. &lt;br /&gt;
 # At each examination, respiratory status (categorized as 1 = good, 0 = poor)&lt;br /&gt;
 data(&amp;quot;respiratory&amp;quot;)&lt;br /&gt;
 head(respiratory)&lt;br /&gt;
 myData &amp;lt;- respiratory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(myData)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Center||ID||Treat||Sex||Age||Baseline||Visit||Outcome&lt;br /&gt;
|-&lt;br /&gt;
|1 ||1||1||P||M||46||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|2 ||1||1||P||M||46||0||2||0&lt;br /&gt;
|-&lt;br /&gt;
|3 ||1||1||P||M||46||0||3||0&lt;br /&gt;
|-&lt;br /&gt;
|4 ||1||1||P||M||46||0||4||0&lt;br /&gt;
|-&lt;br /&gt;
|5||1||2||P||M||28||0||1||0&lt;br /&gt;
|-&lt;br /&gt;
|6||1||2||P||M||28||0||2||0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Get proportions of positive responses&lt;br /&gt;
 responses &amp;lt;- factor(myData$\$$outcome, labels = c(&amp;quot;OutcomePositive&amp;quot;, &amp;quot;OutcomeNegative&amp;quot;))&lt;br /&gt;
 data.frame &amp;lt;- data.frame(responses, myData$\$$age)&lt;br /&gt;
 head(data.frame)&lt;br /&gt;
 tab &amp;lt;- prop.table(table(data.frame), 1); tab	# compute proportions&lt;br /&gt;
 sum(tab[1,])				# check proportions (sums to 1.0)?&lt;br /&gt;
 prop &amp;lt;- tab[1,]				# save the proportions of positive responses for each patient&lt;br /&gt;
 plot(as.numeric(dimnames(tab)$\$$myData.age), tab[1,], xlab = &amp;quot;Age&amp;quot;, ylab = &amp;quot;Proportion of Positive Outcomes&amp;quot;)&lt;br /&gt;
 # dimnames(tab)				# to see/inspect positive/negative outcomes&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci9.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 x &amp;lt;- as.numeric(dimnames(tab)$\$$myData.age)&lt;br /&gt;
 poly &amp;lt;- loess( prop ~ x)	# fit a Local Polynomial Regression Fitting&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(predict(poly), col='red', lwd=2)&lt;br /&gt;
&lt;br /&gt;
 smoothingSpline &amp;lt;- smooth.spline(x, prop, spar=0.6)&lt;br /&gt;
 plot(x, prop)&lt;br /&gt;
 lines(smoothingSpline, col='red', lwd=1.5)&lt;br /&gt;
 smoothPolySpline &amp;lt;- smooth.spline(x, predict(poly), spar=0.6)&lt;br /&gt;
 lines(smoothPolySpline, col='blue', lwd=2)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, inset=.05, title=&amp;quot;Polynomial regression models&amp;quot;,  c(&amp;quot;Raw Poly&amp;quot;,&amp;quot;Smooth Poly&amp;quot;), fill=c('red', 'blue'), horiz=TRUE)&lt;br /&gt;
&lt;br /&gt;
[[Image:SMHS_BigDataBigSci10.png|500px]]&lt;br /&gt;
&lt;br /&gt;
 model.glm &amp;lt;- &amp;lt;b&amp;gt;glm&amp;lt;/b&amp;gt;(outcome ~ baseline + center + sex + treat + age + I(age^2), data = respiratory, family = binomial)&lt;br /&gt;
&lt;br /&gt;
 summary(model.glm)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Deviance Residuals: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
| -2.5951||-0.9108||0.4034||0.8336||2.0951&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Estimate||Std. Error||z value||$Pr( \gt |z|)$  &lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||3.3579727||1.0285292||3.265||0.0011 **&lt;br /&gt;
|-&lt;br /&gt;
|baseline||1.8850421||0.2482959||7.592||3.15e-14 ***&lt;br /&gt;
|-&lt;br /&gt;
|center||0.5099244||0.2453982||2.078||0.0377 *&lt;br /&gt;
|-&lt;br /&gt;
|sexM||-0.4510595||0.3166570||-1.424||0.1543&lt;br /&gt;
|-&lt;br /&gt;
|Treatp||-1.3231587||0.2431603||-5.442||5.28e-08 ***&lt;br /&gt;
|-&lt;br /&gt;
|age||-0.2072815||0.0472538||-4.387||1.15e-05 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||0.0025650||0.0006324||4.056||4.99e-05 ***&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
(Dispersion parameter for binomial family taken to be 1)&lt;br /&gt;
&lt;br /&gt;
Null deviance: 609.41  on 443  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
Residual deviance: 468.62  on 437  degrees of freedom&lt;br /&gt;
&lt;br /&gt;
AIC: 482.62&lt;br /&gt;
&lt;br /&gt;
The correlation matrix of the of the outcome measures across visits is shown in &amp;lt;b&amp;gt;Table 3.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 attach(myData)&lt;br /&gt;
 mat1 &amp;lt;- matrix(c(outcome[visit==1], outcome [visit==2], outcome [visit==3], &lt;br /&gt;
	outcome[visit==4]), ncol = 4)&lt;br /&gt;
 cor(mat1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Table 3&amp;lt;/b&amp;gt;: Correlation matrix for the outcome measurements at different visits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||[,1]||[,2]||[,3]||[,4]&lt;br /&gt;
|-&lt;br /&gt;
|[,1]||1.0000000||0.5087944||0.4431438||0.5139016&lt;br /&gt;
|-&lt;br /&gt;
|[,2]||0.5087944||1.0000000||0.5821877||0.5301611&lt;br /&gt;
|-&lt;br /&gt;
|[,3]||0.4431438||0.5821877||1.0000000||0.5871276&lt;br /&gt;
|-&lt;br /&gt;
|[,4]||0.5139016||0.5301611||0.5871276||1.0000000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # We can also examine for multicollinearity problem, using the correlation matrix for X&lt;br /&gt;
 cor(model.matrix(model.glm)[,-1])&lt;br /&gt;
&lt;br /&gt;
 # GEE modeling: R function arguments/options&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;corstr&amp;lt;/b&amp;gt;= for defining the correlation structure within groups in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt;= is used to identify the grouping variable in a GEE model&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;scale.fix&amp;lt;/b&amp;gt;= when TRUE causes the scale parameter to be fixed (by default at 1) rather than estimated&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;b&amp;gt;waves&amp;lt;/b&amp;gt;= names a positive integer-valued variable that is used to identify the order and spacing of observations within groups in a GEE model. This argument is crucial when there are missing values and gaps in the data&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + treat + sex + baseline + age, data = respiratory, family = &amp;quot;binomial&amp;quot;, id = id, corstr = &amp;quot;exchangeable&amp;quot;, scale.fix = TRUE)&lt;br /&gt;
&lt;br /&gt;
 # The column labeled &amp;lt;b&amp;gt;Wald&amp;lt;/b&amp;gt; in the summary table is the square of the z-statistic. The reported p-values are the &lt;br /&gt;
 # upper tailed probabilities from a chisq1 distribution and test whether the true parameter value ≠0.&lt;br /&gt;
 summary(gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # To test the effect of ''treatment'' using anova()&lt;br /&gt;
 gee.model1 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(outcome ~ center + &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;treat&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id = id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 gee.model2 &amp;lt;- geeglm(outcome ~ center + sex + baseline + age, data = respiratory, family=binomial(link=&amp;quot;logit&amp;quot;), id=id, corstr = &amp;quot;exchangeable&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
 anova(gee.model1, gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # To test whether a categorical predictor with more than two levels should be retained in a GEE model we need &lt;br /&gt;
 # to test the entire set of dummy variables simultaneously as a single construct. &lt;br /&gt;
 # The geepack package provides a method for the anova function for a multivariate Wald test&lt;br /&gt;
 # When the anova function is applied to a single geeglm object it returns sequential Wald tests for &lt;br /&gt;
 # individual predictors with the tests carried out in the order the predictors are listed in the model formula.&lt;br /&gt;
 anova(gee.model1)&lt;br /&gt;
&lt;br /&gt;
===PD GEE example===&lt;br /&gt;
&lt;br /&gt;
This example used the PPMI/PD data to show GEE analysis.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;# 05_PPMI_top_UPDRS_Integrated_LongFormat1.csv&amp;lt;/b&amp;gt;&lt;br /&gt;
 longData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;geepack&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # Data Elements: FID_IID	L_insular_cortex_ComputeArea	L_insular_cortex_Volume	R_insular_cortex_ComputeArea	R_insular_cortex_Volume	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	 R_putamen_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	chr17_rs12185268_GT	chr17_rs199533_GT	UPDRS_part_I	 UPDRS_part_II	UPDRS_part_III	time_visit&lt;br /&gt;
&lt;br /&gt;
 dim(longData) &lt;br /&gt;
&lt;br /&gt;
 data1 = na.omit(longData)&lt;br /&gt;
 attach(data1)&lt;br /&gt;
 ControlGroup &amp;lt;- ifelse(ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # these calculations take a long time!!!&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“Error in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  : &lt;br /&gt;
 # nrow(zsca) and length(y)&amp;lt;/i&amp;gt; not match” – this indicates some of the variables are of different lengths&lt;br /&gt;
 # if you get &amp;lt;i&amp;gt;“glm.fit: algorithm did not converge”&amp;lt;/i&amp;gt; – see this discussion: http://goo.gl/lrjBjB &lt;br /&gt;
&lt;br /&gt;
 gee.model0 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1,  family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 gee.model1 &amp;lt;- geeglm(ControlGroup ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+ R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age + chr17_rs11012_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II +   time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr = &amp;quot;unstructured&amp;quot;, std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # compare 2 gee models&lt;br /&gt;
 # anova(gee.model0,gee.model1)&lt;br /&gt;
&lt;br /&gt;
 # you can try the “family = poisson(link = &amp;quot;log&amp;quot;)” model for the ResearchGroup response, as well&lt;br /&gt;
&lt;br /&gt;
 gee.model2 &amp;lt;- &amp;lt;b&amp;gt;geeglm&amp;lt;/b&amp;gt;(ControlGroup &lt;br /&gt;
 ~ L_insular_cortex_ComputeArea+L_insular_cortex_Volume+R_insular_cortex_ComputeArea+ R_insular_cortex_Volume +L_cingulate_gyrus_ComputeArea + L_cingulate_gyrus_Volume + R_cingulate_gyrus_ComputeArea  + R_cingulate_gyrus_Volume +  L_caudate_ComputeArea + L_caudate_Volume + R_caudate_ComputeArea + R_caudate_Volume + L_putamen_ComputeArea + L_putamen_Volume + R_putamen_ComputeArea + R_putamen_Volume + Sex + Weight + Age +  chr12_rs34637584_GT +   chr17_rs11868035_GT + chr17_rs11012_GT + chr17_rs393152_GT + chr17_rs12185268_GT + chr17_rs199533_GT + UPDRS_part_I + UPDRS_part_II + time_visit, data = data1, family=binomial(link=&amp;quot;logit&amp;quot;), id = FID_IID, corstr  = &amp;quot;unstructured&amp;quot;,  std.err=&amp;quot;san.se&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Remember that we do not interpret GEE coefficients as relating to individuals – GEE models are marginal models and the conclusions drawn are interpreted as population-based. Also, the time element in the model (time_visit) is just another controlling factor. &amp;lt;b&amp;gt;The effect-sizes (betas) associated with each variable/predictor represent the slopes associated with the corresponding covariate, while holding time constant&amp;lt;/b&amp;gt;. If we need to examine interactions (e.g., Weight change over Time), we need to include an interaction term in model: (i.e. + Weight*time_visit).&lt;br /&gt;
&lt;br /&gt;
 summary (gee.model2)&lt;br /&gt;
&lt;br /&gt;
 # Individual Wald test and &amp;lt;b&amp;gt;confidence intervals&amp;lt;/b&amp;gt; for each covariate&lt;br /&gt;
 predictors2 &amp;lt;- coef(summary(gee.model2))&lt;br /&gt;
 CI2 &amp;lt;- with(as.data.frame(predictors2), cbind(lwr=Estimate-1.96*Std.err, est=Estimate, upr=Estimate+1.96*Std.err))&lt;br /&gt;
 rownames(CI2) &amp;lt;- rownames(predictors2)&lt;br /&gt;
 CI2&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
SEM References&lt;br /&gt;
&lt;br /&gt;
*http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf &lt;br /&gt;
&lt;br /&gt;
GEE References&lt;br /&gt;
&lt;br /&gt;
*https://cran.r-project.org/web/packages/geepack/geepack.pdf&lt;br /&gt;
&lt;br /&gt;
*http://www.jstatsoft.org/v15/i02/paper&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://www.jstatsoft.org/v15/i02/ &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; https://books.google.com/books?id=mdEqBgAAQBAJ&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci| Back to Model-based Analytics]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] &lt;br /&gt;
* [[SMHS_BigDataBigSci_GEE| Next Section: Generalized Estimating Equation (GEE) Modeling]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_GCM}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM_Ex2&amp;diff=16232</id>
		<title>SMHS BigDataBigSci SEM Ex2</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM_Ex2&amp;diff=16232"/>
		<updated>2016-05-23T19:10:55Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]] - Hands-on Example 2 (Parkinson’s Disease data) ==&lt;br /&gt;
&lt;br /&gt;
 # Data: PPMI Integrated imaging, demographics, genetics, clinical and cognitive (UPDRS) data. &lt;br /&gt;
 # Dinov et al., 2016&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:75%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Index||FID_IID||L_cingulate_gyrus_ComputeArea||L_cingulate_gyrus_Volume||R_cingulate_gyrus_ComputeArea||R_cingulate_gyrus_Volume||L_caudate_ComputeArea||L_caudate_Volume||R_caudate_ComputeArea||R_caudate_Volume||L_putamen_ComputeArea||L_putamen_Volume||R_putamen_ComputeArea||R_putamen_Volume||L_hippocampus_ComputeArea||L_hippocampus_Volume||R_hippocampus_ComputeArea||R_hippocampus_Volume||cerebellum_ComputeArea||cerebellum_Volume||L_fusiform_gyrus_ComputeArea||L_fusiform_gyrus_Volume||R_fusiform_gyrus_ComputeArea||R_fusiform_gyrus_Volume||Sex||Weight||ResearchGroup||Age||chr12_rs34637584_GT||chr17_rs11868035_GT||chr17_rs11012_GT||chr17_rs393152_GT||chr17_rs12185268_GT||UPDRS_part_I||UPDRS_part_II||UPDRS_part_III||UPDRS_part_IV||time_visit&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||0||2||12||NA||0&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||0||2||18||NA||42&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||0||3||23||NA||24&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||1||3||19||NA||9&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||4||3||20||NA||0&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||1||4||29||NA||42&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||0||2||39||NA||24&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||0||5||25||NA||9&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||1||6||34||NA||0&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||1||11||42||0||42&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||1||5||39||0||24&lt;br /&gt;
|-&lt;br /&gt;
|2||3001||4381.93||11205.13||4610.447||12246.55||621.5344||821.8991||1302.146||2526.248||1029.175||1543.017||1680.197||3792.201||1769.672||4737.038||1578.946||3817.621||20909.58||185742.6||4534.707||15830.32||3945.037||14471.84||1||74.2||PD||65.1808||0||1||1||1||1||NA||NA||NA||NA||9&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||3||15||17||NA||3&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||2||10||22||NA||48&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||NA||NA||NA||NA||30&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||1||16||20||NA||12&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||3||15||27||0||3&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||4||16||22||0||48&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||8||14||22||0||30&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||4||13||24||1||12&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||4||16||31||4||3&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||6||14||19||4||48&lt;br /&gt;
|-&lt;br /&gt;
|3||3002||3221.54||7439.645||3194.348||7264.683||876.9414||1364.86||1056.22||1965.206||1275.905||2696.695||1375.725||2966.682||1529.759||3736.04||1799.439||4665.168||17627.01||155632.3||4013.385||12677.99||3551.876||11263.23||2||70.6||PD||67.6247||0||1||0||0||0||5||18||29||3||30&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lavaan&amp;quot;) &lt;br /&gt;
 library(lavaan)&lt;br /&gt;
 #load data   05_PPMI_top_UPDRS_Integrated_LongFormat1.csv ( dim(myData) 1764   31 )&lt;br /&gt;
 # setwd(&amp;quot;/dir/&amp;quot;)&lt;br /&gt;
 myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;amp;verifier=3bYRT9FXgBGMCQv8MNxsclWnMgodiJRYo3ODFtDq&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 # dichotomize the &amp;quot;ResearchGroup&amp;quot; variable&lt;br /&gt;
 myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 1, 0)&lt;br /&gt;
&lt;br /&gt;
 # Data elements: Index	FID_IID	L_cingulate_gyrus_ComputeArea	L_cingulate_gyrus_Volume	&lt;br /&gt;
 R_cingulate_gyrus_ComputeArea	R_cingulate_gyrus_Volume	L_caudate_ComputeArea	&lt;br /&gt;
 L_caudate_Volume	R_caudate_ComputeArea	R_caudate_Volume	&lt;br /&gt;
 L_putamen_ComputeArea	L_putamen_Volume	R_putamen_ComputeArea	&lt;br /&gt;
 R_putamen_Volume	L_hippocampus_ComputeArea	L_hippocampus_Volume	R_hippocampus_ComputeArea	&lt;br /&gt;
 R_hippocampus_Volume	cerebellum_ComputeArea	&lt;br /&gt;
 cerebellum_Volume	L_fusiform_gyrus_ComputeArea	L_fusiform_gyrus_Volume	R_fusiform_gyrus_ComputeArea	&lt;br /&gt;
 R_fusiform_gyrus_Volume	Sex	Weight	ResearchGroup	Age	chr12_rs34637584_GT	chr17_rs11868035_GT	chr17_rs11012_GT	chr17_rs393152_GT	&lt;br /&gt;
 chr17_rs12185268_GT	UPDRS_Part_I_Summary_Score_Baseline&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_03	UPDRS_Part_I_Summary_Score_Month_06	UPDRS_Part_I_Summary_Score_Month_09	UPDRS_Part_I_Summary_Score_Month_12	UPDRS_Part_I_Summary_Score_Month_18	 UPDRS_Part_I_Summary_Score_Month_24	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06	 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18	  UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24	UPDRS_Part_III_Summary_Score_Baseline	UPDRS_Part_III_Summary_Score_Month_03	UPDRS_Part_III_Summary_Score_Month_06	UPDRS_Part_III_Summary_Score_Month_09	 UPDRS_Part_III_Summary_Score_Month_12	UPDRS_Part_III_Summary_Score_Month_18	UPDRS_Part_III_Summary_Score_Month_24	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline	 X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24	 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06	 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
&lt;br /&gt;
====Validation of the measurement model====&lt;br /&gt;
&lt;br /&gt;
 myData&amp;lt;-within(myData, {&lt;br /&gt;
 L_cingulate_gyrus_ComputeArea &amp;lt;- lm(L_cingulate_gyrus_ComputeArea ~  L_cingulate_gyrus_Volume+R_cingulate_gyrus_ComputeArea+R_cingulate_gyrus_Volume+L_caudate_ComputeArea+L_caudate_Volume+R_caudate_ComputeArea+R_caudate_Volume+L_putamen_ComputeArea+L_putamen_Volume+R_putamen_ComputeArea+R_putamen_Volum e+L_hippocampus_ComputeArea+L_hippocampus_Volume+R_hippocampus_ComputeArea+R_hippocampus_Volume+cerebellum_ComputeArea+cerebellum_Volume+L_fusiform_gyrus_ComputeArea+L_fusiform_gyrus_Volume+R_fusiform_gyrus_ComputeArea+R_fusiform_gyru s_Volume, data=myData)$\$$residuals&lt;br /&gt;
 Weight &amp;lt;- lm(Weight ~ Sex+ResearchGroup+Age+chr12_rs34637584_GT+chr17_rs11868035_GT+chr17_rs11012_GT+chr17_rs393152_GT+chr17_rs12185268_GT, data=myData)$\$$residuals&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Baseline  &amp;lt;- lm(UPDRS_Part_I_Summary_Score_Baseline  ~  UPDRS_Part_I_Summary_Score_Month_03+UPDRS_Part_I_Summary_Score_Month_06+UPDRS_Part_I_Summary_Score_Month_09+UPDRS_Part_I_Summary_Score_Month_12+UPDRS_Part_I_Summary_Score_Month_18+UPDRS_Part_I_Summary_Score_Month_24+UPDRS_Part_II_Pati ent_Questionnaire_Summary_Score_Baseline+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09+UPDRS_Part_II_Pa tient_Questionnaire_Summary_Score_Month_12+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24+UPDRS_Part_III_Summary_Score_Baseline+UPDRS_Part_III_Summary_Score_Month_ 03+UPDRS_Part_III_Summary_Score_Month_06+UPDRS_Part_III_Summary_Score_Month_09+UPDRS_Part_III_Summary_Score_Month_12+UPDRS_Part_III_Summary_Score_Month_18+UPDRS_Part_III_Summary_Score_Month_24+X_Assessment_Non.Motor_Epworth_Sleepiness _Scale_Summary_Score_Baseline+X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06+X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12+X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_ Month_24+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short _Summary_Score_Month_12+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24, data=myData)$\$$residuals })&lt;br /&gt;
&lt;br /&gt;
====Structural Model====&lt;br /&gt;
&lt;br /&gt;
 # Next, proceed with the structural model including the residuals from data to account for effects of site.&lt;br /&gt;
&lt;br /&gt;
Lavaan model specification:&lt;br /&gt;
&lt;br /&gt;
formula type                       operator    	           mnemonic&lt;br /&gt;
latent variable definition	=~	                  is measured by&lt;br /&gt;
regression		        ~	                  is regressed on&lt;br /&gt;
(residual) (co)variance	        ~~	                  is correlated with&lt;br /&gt;
Intercept		        ~ 1	                  Intercept&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
 myModel &amp;lt;-&lt;br /&gt;
 &amp;lt;b&amp;gt;# regressions&amp;lt;/b&amp;gt;&lt;br /&gt;
 y1 + y2 &amp;lt;mark&amp;gt;~&amp;lt;/mark&amp;gt; f1 + f2 + x1 + x2&lt;br /&gt;
 f1 ~ f2 + f3&lt;br /&gt;
 f2 ~ f3 + x1 + x2&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;# latent variable definitions&amp;lt;/b&amp;gt;&lt;br /&gt;
 f1 &amp;lt;mark&amp;gt;=~&amp;lt;/mark&amp;gt; y1 + y2 + y3&lt;br /&gt;
 f2 =~ y4 + y5 + y6&lt;br /&gt;
 f3 =~ y7 + y8 + y9 + y10&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;# variances and covariances&amp;lt;/b&amp;gt;&lt;br /&gt;
 y1 &amp;lt;mark&amp;gt;~~&amp;lt;/mark&amp;gt; y1&lt;br /&gt;
 y1 ~~ y2&lt;br /&gt;
 f1 ~~ f2&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;# intercepts&amp;lt;/b&amp;gt;&lt;br /&gt;
 y1 &amp;lt;mark&amp;gt;~&amp;lt;/mark&amp;gt; 1&lt;br /&gt;
 f1 ~ 1&lt;br /&gt;
  model1 &amp;lt;-&lt;br /&gt;
    '&lt;br /&gt;
 # latent variable definitions - defining how the latent variables are “manifested by” a set of observed &lt;br /&gt;
 # (or manifest) variables, aka “indicators”&lt;br /&gt;
 # (1) Measurement Model &lt;br /&gt;
 Imaging =~ L_cingulate_gyrus_ComputeArea+L_cingulate_gyrus_Volume&lt;br /&gt;
 DemoGeno =~ Weight+Sex+Age&lt;br /&gt;
 UPDRS =~ UPDRS_Part_I_Summary_Score_Baseline+UPDRS_Part_I_Summary_Score_Month_03&lt;br /&gt;
&lt;br /&gt;
 # (2) Regressions &lt;br /&gt;
 ResearchGroup ~ Imaging + DemoGeno + UPDRS &lt;br /&gt;
 '&lt;br /&gt;
 model2 &amp;lt;-&lt;br /&gt;
 '&lt;br /&gt;
 # latent variable definitions - defining how the latent variables are “manifested by” a set of observed &lt;br /&gt;
 # (or manifest) variables, aka “indicators”&lt;br /&gt;
 # (1) Measurement Model &lt;br /&gt;
 Imaging =~  L_cingulate_gyrus_ComputeArea+L_cingulate_gyrus_Volume+R_cingulate_gyrus_ComputeArea+R_cingulate_gyrus_Volume+L_caudate_ComputeArea+L_caudate_Volume+R_caudate_ComputeArea+R_caudate_Volume+L_putamen_ComputeArea+L_putamen_Volume+R_putam en_ComputeArea+R_putamen_Volume+L_hippocampus_ComputeArea+L_hippocampus_Volume+R_hippocampus_ComputeArea+R_hippocampus_Volume+cerebellum_ComputeArea+cerebellum_Volume+L_fusiform_gyrus_ComputeArea+L_fusiform_gyrus_Volume+R_fusiform_gyr us_ComputeArea+R_fusiform_gyrus_Volume&lt;br /&gt;
 DemoGeno =~ Weight+Sex+Age+chr12_rs34637584_GT+chr17_rs11868035_GT+chr17_rs11012_GT+chr17_rs393152_GT+chr17_rs12185268_GT&lt;br /&gt;
 UPDRS =~  UPDRS_Part_I_Summary_Score_Baseline+UPDRS_Part_I_Summary_Score_Month_03+UPDRS_Part_I_Summary_Score_Month_06+UPDRS_Part_I_Summary_Score_Month_09+UPDRS_Part_I_Summary_Score_Month_12+UPDRS_Part_I_Summary_Score_Month_18+UPDRS_Part_I_Summa ry_Score_Month_24+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06+UPDRS_Part_II_Patient_Questionnaire_Sum mary_Score_Month_09+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18+UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24+UPDRS_Part_III_Summary_Score_Baseline +UPDRS_Part_III_Summary_Score_Month_03+UPDRS_Part_III_Summary_Score_Month_06+UPDRS_Part_III_Summary_Score_Month_09+UPDRS_Part_III_Summary_Score_Month_12+UPDRS_Part_III_Summary_Score_Month_18+UPDRS_Part_III_Summary_Score_Month_24+X_Ass essment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline+X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06+X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12+X_Assessment_Non.Motor_Epw orth_Sleepiness_Scale_Summary_Score_Month_24+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06+X_Assessment_Non.Motor_ Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
&lt;br /&gt;
 # (2) Regressions &lt;br /&gt;
 # ResearchGroup ~ Imaging + DemoGeno + UPDRS &lt;br /&gt;
 # transform cat variable to numeric:&lt;br /&gt;
 # myData$\$$ResearchGroup &amp;lt;- ifelse(myData$\$$ResearchGroup == &amp;quot;Control&amp;quot;, 0, &lt;br /&gt;
 # 	ifelse(myData$\$$ResearchGroup == &amp;quot;PD&amp;quot;, 2, 1))&lt;br /&gt;
 RG_ranked ~ Imaging + DemoGeno + UPDRS&lt;br /&gt;
&lt;br /&gt;
 # (3) Residual Variances&lt;br /&gt;
 L_insular_cortex_ComputeArea	~~	L_insular_cortex_ComputeArea&lt;br /&gt;
 L_insular_cortex_Volume	~~	L_insular_cortex_Volume&lt;br /&gt;
 R_insular_cortex_ComputeArea	~~	R_insular_cortex_ComputeArea&lt;br /&gt;
 R_insular_cortex_Volume	~~	R_insular_cortex_Volume&lt;br /&gt;
 L_cingulate_gyrus_ComputeArea	~~	L_cingulate_gyrus_ComputeArea&lt;br /&gt;
 L_cingulate_gyrus_Volume	~~	L_cingulate_gyrus_Volume&lt;br /&gt;
 R_cingulate_gyrus_ComputeArea	~~	R_cingulate_gyrus_ComputeArea&lt;br /&gt;
 R_cingulate_gyrus_Volume	~~	R_cingulate_gyrus_Volume&lt;br /&gt;
 L_caudate_ComputeArea	~~	L_caudate_ComputeArea&lt;br /&gt;
 L_caudate_Volume	~~	L_caudate_Volume&lt;br /&gt;
 R_caudate_ComputeArea	~~	R_caudate_ComputeArea&lt;br /&gt;
 R_caudate_Volume	~~	R_caudate_Volume&lt;br /&gt;
 L_putamen_ComputeArea	~~	L_putamen_ComputeArea&lt;br /&gt;
 L_putamen_Volume	~~	L_putamen_Volume&lt;br /&gt;
 R_putamen_ComputeArea	~~	R_putamen_ComputeArea&lt;br /&gt;
 R_putamen_Volume	~~	R_putamen_Volume&lt;br /&gt;
 L_hippocampus_ComputeArea	~~	L_hippocampus_ComputeArea&lt;br /&gt;
 L_hippocampus_Volume	~~	L_hippocampus_Volume&lt;br /&gt;
 R_hippocampus_ComputeArea	~~	R_hippocampus_ComputeArea&lt;br /&gt;
 R_hippocampus_Volume	~~	R_hippocampus_Volume&lt;br /&gt;
 cerebellum_ComputeArea	~~	cerebellum_ComputeArea&lt;br /&gt;
 cerebellum_Volume	~~	cerebellum_Volume&lt;br /&gt;
 L_fusiform_gyrus_ComputeArea	~~	L_fusiform_gyrus_ComputeArea&lt;br /&gt;
 L_fusiform_gyrus_Volume	~~	L_fusiform_gyrus_Volume&lt;br /&gt;
 R_fusiform_gyrus_ComputeArea	~~	R_fusiform_gyrus_ComputeArea&lt;br /&gt;
 R_fusiform_gyrus_Volume	~~	R_fusiform_gyrus_Volume&lt;br /&gt;
 R_fusiform_gyrus_ShapeIndex	~~	R_fusiform_gyrus_ShapeIndex&lt;br /&gt;
 R_fusiform_gyrus_Curvedness	~~	R_fusiform_gyrus_Curvedness&lt;br /&gt;
 Sex	~~	Sex&lt;br /&gt;
 Weight	~~	Weight&lt;br /&gt;
 ResearchGroup	~~	ResearchGroup&lt;br /&gt;
 VisitID	~~	VisitID&lt;br /&gt;
 Age	~~	Age&lt;br /&gt;
 chr12_rs34637584_GT	~~	chr12_rs34637584_GT&lt;br /&gt;
 chr17_rs11868035_GT	~~	chr17_rs11868035_GT&lt;br /&gt;
 chr17_rs11012_GT	~~	chr17_rs11012_GT&lt;br /&gt;
 chr17_rs393152_GT	~~	chr17_rs393152_GT&lt;br /&gt;
 chr17_rs12185268_GT	~~	chr17_rs12185268_GT&lt;br /&gt;
 chr17_rs199533_GT	~~	chr17_rs199533_GT&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Baseline	~~	UPDRS_Part_I_Summary_Score_Baseline&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_03	~~	UPDRS_Part_I_Summary_Score_Month_03&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_06	~~	UPDRS_Part_I_Summary_Score_Month_06&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_09	~~	UPDRS_Part_I_Summary_Score_Month_09&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_12	~~	UPDRS_Part_I_Summary_Score_Month_12&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_18	~~	UPDRS_Part_I_Summary_Score_Month_18&lt;br /&gt;
 UPDRS_Part_I_Summary_Score_Month_24	~~	UPDRS_Part_I_Summary_Score_Month_24&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Baseline&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_03&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_06&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_09&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_12&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_18&lt;br /&gt;
 UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24	~~	UPDRS_Part_II_Patient_Questionnaire_Summary_Score_Month_24&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Baseline	~~	UPDRS_Part_III_Summary_Score_Baseline&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_03	~~	UPDRS_Part_III_Summary_Score_Month_03&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_06	~~	UPDRS_Part_III_Summary_Score_Month_06&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_09	~~	UPDRS_Part_III_Summary_Score_Month_09&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_12	~~	UPDRS_Part_III_Summary_Score_Month_12&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_18	~~	UPDRS_Part_III_Summary_Score_Month_18&lt;br /&gt;
 UPDRS_Part_III_Summary_Score_Month_24	~~	UPDRS_Part_III_Summary_Score_Month_24&lt;br /&gt;
 X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline	~~	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Baseline&lt;br /&gt;
 X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06	~~	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_06&lt;br /&gt;
 X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12	~~	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_12&lt;br /&gt;
 X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24	~~	X_Assessment_Non.Motor_Epworth_Sleepiness_Scale_Summary_Score_Month_24&lt;br /&gt;
 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline	~~	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline&lt;br /&gt;
 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06	~~	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_06&lt;br /&gt;
 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12	~~	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_12&lt;br /&gt;
 X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24	~~	X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Month_24&lt;br /&gt;
 &lt;br /&gt;
 # (4) Residual Covariances &lt;br /&gt;
 Sex ~~ Weight&lt;br /&gt;
 '&lt;br /&gt;
 # confirmatory factor analysis (CFA)&lt;br /&gt;
 # The baseline is a null model constraining the observed variables to covary with no other variables.&lt;br /&gt;
 # That is, the covariances are fixed to 0 and only individual variances are estimated. This is represents&lt;br /&gt;
 # a “reasonable worst-possible fitting model”, against which the new fitted model is compared &lt;br /&gt;
 # to calculate appropriate model-quality indices (e.g., CFA).&lt;br /&gt;
&lt;br /&gt;
 # standardize all variable to avoid huge variations between variable distributions&lt;br /&gt;
 library(&amp;quot;MASS&amp;quot;)&lt;br /&gt;
 # myData &amp;lt;- read.csv(&amp;quot;https://umich.instructure.com/files/330397/download?download_frd=1&amp;amp;verifier=3bYRT9FXgBGMCQv8MNxsclWnMgodiJRYo3ODFtDq&amp;quot;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
 summary(myData)&lt;br /&gt;
 myData2&amp;lt;-scale(myData); summary(myData2)&lt;br /&gt;
&lt;br /&gt;
 myDF &amp;lt;- data.frame(myData2)&lt;br /&gt;
 # myDF3 &amp;lt;- subset(myDF, select=c(&amp;quot;L_cingulate_gyrus_ComputeArea&amp;quot;, &amp;quot;cerebellum_Volume&amp;quot;, &amp;quot;Weight&amp;quot;, &amp;quot;Sex&amp;quot;, &amp;quot;Age&amp;quot;, &amp;quot; UPDRS_part_I&amp;quot;, &amp;quot;UPDRS_part_II&amp;quot;, &amp;quot;UPDRS_part_III&amp;quot;, &amp;quot;ResearchGroup&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
 myDF3 &amp;lt;- subset(myDF, select=c(&amp;quot;R_insular_cortex_ComputeArea&amp;quot;,  &amp;quot;R_insular_cortex_Volume&amp;quot;, &amp;quot;Sex&amp;quot;, &amp;quot;Weight&amp;quot;,     &amp;quot;ResearchGroup&amp;quot;, &amp;quot;Age&amp;quot;, &amp;quot;chr12_rs34637584_GT&amp;quot;, &amp;quot;chr17_rs11868035_GT&amp;quot;, &amp;quot;chr17_rs11012_GT&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
 model3 &amp;lt;-&lt;br /&gt;
 '&lt;br /&gt;
 # latent variable definitions - defining how the latent variables are “manifested by” a set of observed &lt;br /&gt;
 # (or manifest) variables, aka “indicators”&lt;br /&gt;
 # (1) Measurement Model &lt;br /&gt;
 # Imaging =~ L_cingulate_gyrus_ComputeArea + cerebellum_Volume&lt;br /&gt;
 Imaging =~  R_insular_cortex_ComputeArea + R_insular_cortex_Volume&lt;br /&gt;
 DemoGeno =~ Weight+Sex+Age&lt;br /&gt;
 # UPDRS =~ UPDRS_Part_I_Summary_Score_Baseline+X_Assessment_Non.Motor_Geriatric_Depression_Scale_GDS_Short_Summary_Score_Baseline&lt;br /&gt;
 UPDRS =~  UPDRS_part_I  +UPDRS_part_II + UPDRS_part_III&lt;br /&gt;
 # (2) Regressions &lt;br /&gt;
 ResearchGroup ~ Imaging + DemoGeno + UPDRS&lt;br /&gt;
&lt;br /&gt;
 fit3 &amp;lt;- cfa(model3, data= myData2, missing='FIML') 		# deal with missing values (missing='FIML')&lt;br /&gt;
 summary(fit3, fit.measures=TRUE)&lt;br /&gt;
 lavaan (0.5-18) converged normally after 2044 iterations&lt;br /&gt;
 Number of observations       &amp;amp;nbsp;&amp;amp;nbsp;             1764&lt;br /&gt;
 Number of missing patterns   &amp;amp;nbsp;&amp;amp;nbsp;             3&lt;br /&gt;
 Estimator                    &amp;amp;nbsp;&amp;amp;nbsp;             ML&lt;br /&gt;
 Minimum Function Test Statistic  &amp;amp;nbsp;&amp;amp;nbsp;         455.923&lt;br /&gt;
 Degrees of freedom           &amp;amp;nbsp;&amp;amp;nbsp;             15&lt;br /&gt;
 P-value (Chi-square)         &amp;amp;nbsp;&amp;amp;nbsp;             0.000&lt;br /&gt;
 Model test baseline model:&lt;br /&gt;
 Minimum Function Test Statistic  &amp;amp;nbsp;&amp;amp;nbsp;         2625.020&lt;br /&gt;
 Degrees of freedom               &amp;amp;nbsp;&amp;amp;nbsp;         28&lt;br /&gt;
 P-value                          &amp;amp;nbsp;&amp;amp;nbsp;         0.000&lt;br /&gt;
 User model versus baseline model:&lt;br /&gt;
 Comparative Fit Index (CFI)      &amp;amp;nbsp;&amp;amp;nbsp;         0.830&lt;br /&gt;
 Tucker-Lewis Index (TLI)          &amp;amp;nbsp;&amp;amp;nbsp;        0.683&lt;br /&gt;
 Loglikelihood and Information Criteria:&lt;br /&gt;
 Loglikelihood user model (H0)      &amp;amp;nbsp;&amp;amp;nbsp;       -51499.484&lt;br /&gt;
 Loglikelihood unrestricted model (H1) &amp;amp;nbsp;&amp;amp;nbsp;    -51271.522&lt;br /&gt;
 Number of free parameters          &amp;amp;nbsp;&amp;amp;nbsp;        29&lt;br /&gt;
 Akaike (AIC)                       &amp;amp;nbsp;&amp;amp;nbsp;        103056.967&lt;br /&gt;
 Bayesian (BIC)                     &amp;amp;nbsp;&amp;amp;nbsp;        103215.752&lt;br /&gt;
 Sample-size adjusted Bayesian (BIC)  &amp;amp;nbsp;&amp;amp;nbsp;      103123.621&lt;br /&gt;
 Root Mean Square Error of Approximation:&lt;br /&gt;
 RMSEA                              &amp;amp;nbsp;&amp;amp;nbsp;        0.129&lt;br /&gt;
 90 Percent Confidence Interval     &amp;amp;nbsp;&amp;amp;nbsp;       0.119  0.139&lt;br /&gt;
 P-value RMSEA &amp;lt;= 0.05              &amp;amp;nbsp;&amp;amp;nbsp;       0.000&lt;br /&gt;
 Standardized Root Mean Square Residual:&lt;br /&gt;
 SRMR                               &amp;amp;nbsp;&amp;amp;nbsp;       0.062&lt;br /&gt;
 Parameter estimates:&lt;br /&gt;
 Information                        &amp;amp;nbsp;&amp;amp;nbsp;      Observed&lt;br /&gt;
 Standard Errors                    &amp;amp;nbsp;&amp;amp;nbsp;      Standard&lt;br /&gt;
&lt;br /&gt;
Estimate  Std.err  Z-value  P(&amp;gt;|z|)&lt;br /&gt;
&lt;br /&gt;
 Latent variables:&lt;br /&gt;
 Imaging =~&lt;br /&gt;
 R_cnglt_gyr_V    &amp;amp;nbsp;&amp;amp;nbsp;   1.000&lt;br /&gt;
 L_cadt_CmptAr  &amp;amp;nbsp;&amp;amp;nbsp;   493.058&lt;br /&gt;
 DemoGeno =~&lt;br /&gt;
 Weight      &amp;amp;nbsp;&amp;amp;nbsp;        1.000&lt;br /&gt;
 Sex         &amp;amp;nbsp;&amp;amp;nbsp;       24.158&lt;br /&gt;
 Age          &amp;amp;nbsp;&amp;amp;nbsp;       0.094&lt;br /&gt;
 UPDRS =~&lt;br /&gt;
 UPDRS_part_I   &amp;amp;nbsp;&amp;amp;nbsp;     1.000&lt;br /&gt;
 UPDRS_part_II   &amp;amp;nbsp;&amp;amp;nbsp;    7.389&lt;br /&gt;
 Regressions:&lt;br /&gt;
 ResearchGroup ~&lt;br /&gt;
 Imaging     &amp;amp;nbsp;&amp;amp;nbsp;       -0.000&lt;br /&gt;
 DemoGeno    &amp;amp;nbsp;&amp;amp;nbsp;      0.002&lt;br /&gt;
 UPDRS       &amp;amp;nbsp;&amp;amp;nbsp;     -0.323&lt;br /&gt;
 Covariances:&lt;br /&gt;
 Imaging ~~&lt;br /&gt;
 DemoGeno      &amp;amp;nbsp;&amp;amp;nbsp;      0.001&lt;br /&gt;
 UPDRS         &amp;amp;nbsp;&amp;amp;nbsp;       0.002&lt;br /&gt;
 DemoGeno ~~&lt;br /&gt;
 UPDRS        &amp;amp;nbsp;&amp;amp;nbsp;       0.000&lt;br /&gt;
 Intercepts:&lt;br /&gt;
 R_cnglt_gyr_V  &amp;amp;nbsp;&amp;amp;nbsp;  7895.658&lt;br /&gt;
 L_cadt_CmptAr  &amp;amp;nbsp;&amp;amp;nbsp;   635.570&lt;br /&gt;
 Weight       &amp;amp;nbsp;&amp;amp;nbsp;      82.048&lt;br /&gt;
 Sex         &amp;amp;nbsp;&amp;amp;nbsp;        1.340&lt;br /&gt;
 Age         &amp;amp;nbsp;&amp;amp;nbsp;       61.073&lt;br /&gt;
 UPDRS_part_I   &amp;amp;nbsp;&amp;amp;nbsp;     1.126&lt;br /&gt;
 UPDRS_part_II  &amp;amp;nbsp;&amp;amp;nbsp;     4.905&lt;br /&gt;
 ResearchGroup   &amp;amp;nbsp;&amp;amp;nbsp;    0.290&lt;br /&gt;
 Imaging       &amp;amp;nbsp;&amp;amp;nbsp;      0.000&lt;br /&gt;
 DemoGeno      &amp;amp;nbsp;&amp;amp;nbsp;      0.000&lt;br /&gt;
 UPDRS         &amp;amp;nbsp;&amp;amp;nbsp;      0.000&lt;br /&gt;
 Variances:&lt;br /&gt;
 R_cnglt_gyr_V  &amp;amp;nbsp;&amp;amp;nbsp; 17070159.189&lt;br /&gt;
 L_cadt_CmptAr  &amp;amp;nbsp;&amp;amp;nbsp; -536243845.090&lt;br /&gt;
 Weight           &amp;amp;nbsp;&amp;amp;nbsp; 274.912&lt;br /&gt;
 Sex               &amp;amp;nbsp;&amp;amp;nbsp; 96.664&lt;br /&gt;
 Age              &amp;amp;nbsp;&amp;amp;nbsp; 105.347&lt;br /&gt;
 UPDRS_part_I       &amp;amp;nbsp;&amp;amp;nbsp; 2.442&lt;br /&gt;
 UPDRS_part_II     &amp;amp;nbsp;&amp;amp;nbsp; -0.256&lt;br /&gt;
 ResearchGroup      &amp;amp;nbsp;&amp;amp;nbsp; 0.149&lt;br /&gt;
 Imaging         &amp;amp;nbsp;&amp;amp;nbsp; 2206.397&lt;br /&gt;
 DemoGeno          &amp;amp;nbsp;&amp;amp;nbsp; -0.165&lt;br /&gt;
 UPDRS              &amp;amp;nbsp;&amp;amp;nbsp; 0.550&lt;br /&gt;
  '&lt;br /&gt;
&lt;br /&gt;
====Output====&lt;br /&gt;
3 parts of the Lavaan SEM output&lt;br /&gt;
*First six lines are called the header contains the following information:&lt;br /&gt;
*lavaan version number&lt;br /&gt;
*lavaan converge info (normal or not), and # iterations needed&lt;br /&gt;
*the number of observations that were effectively used in the analysis&lt;br /&gt;
*the estimator that was used to obtain the parameter values (here: ML)&lt;br /&gt;
*the model test statistic, the degrees of freedom, and a corresponding p-value&lt;br /&gt;
&lt;br /&gt;
# Next, is the Model test baseline model and the value for the SRMR&lt;br /&gt;
# The last section contains the parameter estimates, standard errors (if the information matrix is expected or observed, and if the standard errors are standard, robust, or based on the bootstrap).  Then, it tabulates all free (and fixed) parameters that were included in the model.  Typically, first the latent variables are shown, followed by covariances and (residual) variances.  The first column (Estimate) contains the (estimated or fixed) parameter value for each model parameter;  the second column (Std.err) contains  the  standard  error  for  each  estimated  parameter;  the  third  column  (Z-value)  contains  the  Wald statistic (which is simply obtained by dividing the parameter value by its standard error), and the last column contains the p-value for testing the null hypothesis that the parameter equals zero in the population.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; You can get this type of error ''&amp;lt;b&amp;gt;“…system is computationally singular: reciprocal condition…”,&amp;lt;/b&amp;gt;'' which indicates that the design matrix is not invertible. Thus, it can't be used to develop a regression model. This is due to linearly dependent columns, i.e. strongly correlated variables. Resolve pairwise covariances (or correlations) of your variables to investigate if there are any variables that can potentially be removed. You're looking for covariances (or correlations) &amp;gt;&amp;gt; 0. We can also automate this variable selection by using a forward stepwise regression.&lt;br /&gt;
&lt;br /&gt;
 # Graphical fit model visualization&lt;br /&gt;
 library(semPlot)&lt;br /&gt;
 semPaths(fit3)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci4.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 semPaths(fit3, &amp;quot;std&amp;quot;, ask = FALSE, as.expression = &amp;quot;edges&amp;quot;, mar = c(3, 1, 5, 1))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_BigDataBigSci5.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM_sem_vs_cfa| Next See: Differences and Similarities between '''sem'''() and '''cfa'''() ]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM| Back to Structural Equation Modeling (SEM)]]&lt;br /&gt;
* [[SMHS_BigDataBigSci_SEM_Ex1| Back to SEM Example 1: School Kids Mental Abilities]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci_SEM_Ex2}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci&amp;diff=16231</id>
		<title>SMHS BigDataBigSci</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci&amp;diff=16231"/>
		<updated>2016-05-23T19:09:25Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS| Scientific Methods for Health Sciences]] - Model-based Analyses ==&lt;br /&gt;
&lt;br /&gt;
Structural Equation Modeling (SEM), Growth Curve Models (GCM), and Generalized Estimating Equation (GEE) Modeling&lt;br /&gt;
&lt;br /&gt;
==Questions ==&lt;br /&gt;
&lt;br /&gt;
*How to represent dependencies in linear models and examine causal effects?&lt;br /&gt;
*Is there a way to study population average effects of a covariate against specific individual effects?&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
SEM allow re-parameterization of random-effects to specify latent variables that may affect measures at different time points using structural equations. SEM show variables having predictive (possibly causal) effects on other variables (denoted by arrows) where coefficients index the strength and direction of predictive relations. SEM does not offer much more than what classical regression methods do, but it does allow simultaneous estimation of multiple equations modeling complementary relations. &lt;br /&gt;
&lt;br /&gt;
Growth Curve (or latent growth) modeling is a statistical technique employed in SEM for estimating growth trajectories for longitudinal data (over time). It represent repeated measures of dependent variables as functions of time and other covariates. When subjects or units are observed repeatedly over known time points latent growth curve models reveal the trend of an individual as a function of an underlying growth process where the growth curve parameters can be estimated for each subject/unit.&lt;br /&gt;
&lt;br /&gt;
GEE is a marginal longitudinal method that directly assesses the mean relations of interest (i.e., how the mean dependent variable changes over time), accounting for covariances among the observations within subjects, and getting a better estimate and valid significance tests of the relations. Thus, GEE estimates two different equations, (1) for the mean relations, and (2) for the covariance structure. An advantage of GEE over random-effect models is that it does not require the dependent variable to be normally distributed. However, a disadvantage of GEE is that it is less flexible and versatile – commonly employed algorithms for it require a small-to-moderate number of time points evenly (or approximately evenly) spaced, and similarly spaced across subjects. Nevertheless, it is a little more flexible than repeated-measure ANOVA because it permits some missing values and has an easy way to test for and model away the specific form of autocorrelation within subjects.&lt;br /&gt;
&lt;br /&gt;
GEE is mostly used when the study is focused on uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent for linear models, but not in non-linear models.&lt;br /&gt;
&lt;br /&gt;
For instance, suppose $Y_{i,j}$ is the random effects &amp;lt;b&amp;gt;logistic model&amp;lt;/b&amp;gt; of the $j^{th}$,  observation of the $i^{th}$ subject, then &lt;br /&gt;
$&lt;br /&gt;
log\Bigg(\frac{p_{i,j}}{1-p_{i,j}} \Bigg)=μ+ν_i,&lt;br /&gt;
$&lt;br /&gt;
where  $ν_i \sim N(0,σ^2)$ is a random effect for &amp;lt;u&amp;gt;subject i&amp;lt;/u&amp;gt; and $p_{i,j}=P(Y_{i,j}=1|ν_i).$&lt;br /&gt;
&lt;br /&gt;
(1) When using a random effects model on such data, the estimate of μ accounts for the fact that a mean zero normally distributed perturbation was applied to each individual, making it ''individual-specific''.&lt;br /&gt;
&lt;br /&gt;
(2) When using a GEE model on the same data, we estimate the &amp;lt;i&amp;gt;population average log odds&amp;lt;/i&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
\begin{equation}&lt;br /&gt;
δ=log\Bigg(\frac{E_v(\frac{1}{1+e^{-μ+v}i})}{1-E_v(\frac{1}{1+e^{-μ+v}i})}&lt;br /&gt;
\Bigg),&lt;br /&gt;
\end{equation} &lt;br /&gt;
&lt;br /&gt;
in general $μ≠δ$.&lt;br /&gt;
&lt;br /&gt;
If $μ=1$ and $σ^2=1$, then $δ≈.83$. &lt;br /&gt;
&lt;br /&gt;
empirically:&lt;br /&gt;
&lt;br /&gt;
m &amp;lt;- 1; s &amp;lt;- 1; v&amp;lt;-rnorm(1000, 0,s); v2 &amp;lt;- 1/(1+exp(-m+v)); v_mean &amp;lt;- mean(v2)&lt;br /&gt;
&lt;br /&gt;
d &amp;lt;- log(v_mean/(1-v_mean)); d&lt;br /&gt;
&lt;br /&gt;
Note that the random effects have mean zero on the transformed, linked, scale, but their effect is not mean zero on the original scale of the data. We can also simulate data from a mixed effects logistic regression model and compare the population level average with the inverse-logit of the intercept to see that they are not equal. This leads to a difference of the interpretation of the coefficients between GEE and random effects models, or SEM.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;That is, there will be a difference between the GEE population average coefficients and the individual specific coefficients (random effects models).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;# theoretically&amp;lt;/b&amp;gt;, if it can be computed:&lt;br /&gt;
&lt;br /&gt;
$E(Y)=μ=1$ (in this specific case), but the expectation of the population average log odds &lt;br /&gt;
$δ=log\Bigg[\frac{P(Y_{i,j}=1|v_i)}{1-P(Y_{i,j}=1|v_i)}\Bigg]$  would be $&amp;lt; 1$ &amp;lt;SUP&amp;gt;1&amp;lt;/SUP&amp;gt;. &lt;br /&gt;
Note that this is kind of related to the fact that a grand-total average  need not be equal to an average of partial averages. &lt;br /&gt;
&lt;br /&gt;
The mean of the $i^{th}$ person in the $j^{th}$ observation (e.g., location, time, etc.) can be expressed by:&lt;br /&gt;
&lt;br /&gt;
$E(Yij | Xij,α_j)= g[μ(Xij|β)+Uij(α_j,Xij)]$,&lt;br /&gt;
&lt;br /&gt;
Where $μ(X_{ij}|β)$ is the average “response” of a person with the same covariates $X_{ij}$, $β$ a set of fixed effect coefficients, and $Uij(α_j,Xij)$ is an error term that is a function of the (time, space) random effects, $α_j$, and also a  function of the covariates $X_{ij}$, and $g$ is the '''link function''' which specifies the regression type -- e.g., &lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;u&amp;gt;linear&amp;lt;/u&amp;gt;:''' 		$g^{-1} (u)=u,$&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;u&amp;gt;log&amp;lt;/u&amp;gt;:'''		        $g^{-1} (u)= log(u),$ &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;u&amp;gt;logistic&amp;lt;/u&amp;gt;:''' 		$g^{-1} (u)=log(\frac{u}{1-u})$&lt;br /&gt;
 &lt;br /&gt;
*$E(Uij(α_j,Xij)|Xij)=0.$&lt;br /&gt;
&lt;br /&gt;
The link function, $g(u)$, provides the relationship between the linear predictor and the mean of the distribution function. For practical applications there are many commonly used link functions. It makes sense to try to match the domain of the link function to the range of the distribution function's mean.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Common distributions with typical uses and canonical link functions&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Distribution&amp;lt;/b&amp;gt; ||&amp;lt;b&amp;gt;Support of distribution&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Typical uses&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Link name&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Link function&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Mean function&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Normal||real: $(-&amp;amp;#8734;, +&amp;amp;#8734;)$||Linear-response data||Identity||$X\beta=\mu$||$\mu=X\beta$&lt;br /&gt;
|-&lt;br /&gt;
|Exponential, Gamma||real:$(0, +&amp;amp;#8734;)$||Exponential-response data, scale parameters||Inverse||$X\beta=-\mu^{-1}$||$\mu=-(X\beta)^{-1}$&lt;br /&gt;
|-&lt;br /&gt;
|Inverse Gaussian||real:$(0, +&amp;amp;#8734;)$|| ||Inverse squared||$X\beta=-\mu^{-2}$||$\mu=(-X\beta)^{-1/2}$ &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://www.researchgate.net/publication/41895248&lt;br /&gt;
&lt;br /&gt;
==Model-based Analytics==&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_SEM| Structural Equation Modeling (SEM)]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_GCM| Growth Curve Modeling (GCM)]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_GEE| Generalized Estimating Equation (GEE) Modeling]]===&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_BigDataBigSci_CrossVal|Internal Validation - Statistical n-fold cross-validaiton]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=SMHS_BigDataBigSci}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16230</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16230"/>
		<updated>2016-05-23T19:03:37Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, http://www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
*&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt; http://www.nejm.org/doi/full/10.1056/NEJMoa072761&lt;br /&gt;
*&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; http://jech.bmj.com/content/59/9/740.short&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16229</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16229"/>
		<updated>2016-05-23T19:02:54Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Case-Study 3: The Nurses’ Health Study */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, http://www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
*&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt; http://www.nejm.org/doi/full/10.1056/NEJMoa072761&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16228</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16228"/>
		<updated>2016-05-23T19:02:19Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, http://www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
*&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt; http://www.nejm.org/doi/full/10.1056/NEJMoa072761&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16227</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16227"/>
		<updated>2016-05-23T19:01:38Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Case-Study 2: The Rosiglitazone Study */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, http://www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16226</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16226"/>
		<updated>2016-05-23T19:00:26Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, http://www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16225</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16225"/>
		<updated>2016-05-23T18:58:39Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Compete Dataset for N-of-1 Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; Based on 2009 NPC report, www.npcnow.org/publication/demystifying-comparative-effectiveness-research-case-study-learning-guide &lt;br /&gt;
*&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt; http://www.cancer.gov/cancertopics/druginfo/fda-cetuximab&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16224</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16224"/>
		<updated>2016-05-23T18:57:45Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Case-Study 1: The Cetuximab Study */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study&amp;lt;sup&amp;gt;14&amp;lt;/sup&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16223</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16223"/>
		<updated>2016-05-23T18:57:20Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /*  Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research - Comparative Effectiveness Research (CER) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research: Case Studies &amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt; (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16222</id>
		<title>SMHS MethodsHeterogeneity CER</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_CER&amp;diff=16222"/>
		<updated>2016-05-23T18:56:34Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Observational Studies: Tips for the CER Practitioners */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Comparative Effectiveness Research (CER) ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
===Observational Studies: Tips for the CER Practitioners===&lt;br /&gt;
&lt;br /&gt;
*Different study types can offer different understandings; neither should be discounted without closer examination.&lt;br /&gt;
&lt;br /&gt;
*RCTs provide an accurate understanding of the effect of a particular intervention in a well-defined patient group under “controlled” circumstances.&lt;br /&gt;
&lt;br /&gt;
*Observational studies provide an understanding of real-world care and its impact, but can be biased due to uncontrolled factors.&lt;br /&gt;
&lt;br /&gt;
*Observational studies differ in the types of databases used. These databases may lack clinical detail and contain incomplete or inaccurate data.&lt;br /&gt;
&lt;br /&gt;
*Before accepting the findings from an observational study, consider whether confounding factors may have influenced the results.&lt;br /&gt;
&lt;br /&gt;
*In this scenario, subgroup analysis was vital in clarifying both study designs; what is true for the many (e.g., overall, estrogen appeared to be detrimental) may not be true for the few (e.g., that for the younger post-menopausal woman, the benefits were greater and the harms less frequent).&lt;br /&gt;
&lt;br /&gt;
*Carefully examine the generalizability of the study. Do the study’s patients and intervention match those under consideration?&lt;br /&gt;
&lt;br /&gt;
*Observational studies can identify associations but cannot prove cause-and-effect relationships.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 1: The Cetuximab Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done and what was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cetuximab, an anti-epidermal growth factor receptor (EGFR) agent, has recently been added to the therapeutic armamentarium.  Two important CRTs examined its impact in patients with mCRC (metastatic-stage Colorectal cancer). In the first one, 56 centers in 11 European countries investigated the outcomes associated with cetuximab therapy in 329 mCRC patients who experienced disease progression either on irinotecan therapy or within 3 months thereafter. The study reported that the group on a combination of irinotecan and cetuximab had a significantly higher rate of overall response to treatment (primary endpoint) than the group on cetuximab alone: 22.9% (95% CI, 17.5-29.1%) vs. 10.8% (95% CI, 5.7-18.1%) (P=0.007), respectively. Similarly, the median time to progression was significantly longer in the combination therapy group (4.1 vs. 1.5 months, P&amp;lt;0.001). As these patients had already progressed on irinotecan prior to the study, any response was viewed as positive. Safety between the two treatment arms was similar: approximately 80% of patients in each arm experienced a rash. Grade 3 or 4 (the more severe) toxic effects on the skin were slightly more frequent in the combination-therapy group compared to cetuximab monotherapy, observed in 9.4% and 5.2% of participants, respectively. Other side effects, such as diarrhea and neutropenia observed in the combination-therapy arm, were considered to be in the range expected for irinotecan alone. Data from this study demonstrated the efficacy and safety of cetuximab and were instrumental in the FDA’s 2004 approval.&lt;br /&gt;
&lt;br /&gt;
A second CRT (2007) examined 572 patients and suggested efficacy of cetuximab in the treatment of mCRC. This study was a randomized, non-blinded, controlled trial that examined cetuximab monotherapy plus best supportive care compared to best supportive care alone in patients who had received and failed prior chemotherapy regimens. It reported that median overall survival (the primary endpoint) was significantly higher in patients receiving cetuximab plus best supportive care compared to best supportive care alone (6.1 vs. 4.6 months, respectively) (hazard ratio for death=0.77; 95% CI: 0.64- 0.92, P=0.005). This RCT described a greater incidence of adverse events in the cetuximab plus best supportive care group compared to best supportive care alone including (most significantly) rash, as well as edema, fatigue, nausea and vomiting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These RCTs had fairly broad enrollment criteria and the cetuximab benefits were modest. Emerging scientific theories raised the possibility that genetically defined population subsets might experience a greater-than-average treatment benefit. One such area of inquiry entailed examining “biomarkers,” or genetic indicators of a patient’s greater response to therapy. Even as the above RCTs were being conducted, data emerged showing the importance of the KRAS gene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the emerging biochemical evidence that the epidermal growth factor receptor (EGFR) treatment mechanism (Cetuximab) was even more finely detailed than previously understood, the study authors of the 2007 RCT undertook a retrospective subgroup analysis using tumor tissue samples preserved from their initial study. Following laboratory analysis, all viable tissue samples were classified as having a wild-type (non-mutated) or a mutated KRAS gene. Instead of the previous two study arms (cetuximab plus best supportive care vs. best supportive care alone), there were 4 for this new analysis: each of the two original study arms was further divided by wild-type vs. mutated KRAS status. Laboratory evaluation determined that 40.9% and 42.3% of all patients in the RCT had a KRAS mutation in the cetuximab plus best supportive care group compared to the best supportive care group alone, respectively. The efficacy of cetuximab was found to be significantly correlated with KRAS status: in patients with wild-type (non-mutated). KRAS genes, cetuximab plus best supportive care compared to best supportive care alone improved overall survival (median 9.5 vs. 4.8 months, respectively; hazard ratio  for death=0.55; 95% CI, 0.41-0.74, P&amp;lt;0.001), and progression-free survival (median 3.7 vs. 1.9 months, respectively; hazard ratio for progression or death=0.40; 95% CI, 0.30-0.54, P&amp;lt;0.001). Meanwhile, in patients with mutated KRAS tumors, the authors found no significant difference in outcome between cetuximab plus best supportive care vs. best supportive care alone.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on these and similar results from other studies, the FDA narrowed its product labeling in July 2009 to indicate that cetuximab is not recommended for mCRC patients with mutated KRAS tumors. This distinction reduces the relevant population by approximately 40%. Similarly, the American society of Clinical oncology released a provisional clinical recommendation that all mCRC patients have their tumors tested for KRAS status before receiving anti-EGFR therapy. The benefits of targeted treatment are many. Patients who previously underwent cetuximab therapy without knowing their genetic predisposition would no longer have to be exposed to the drug’s toxic effects if unnecessary, as the efficacy of cetuximab is markedly higher in the genetically defined appropriate patients. In a less-uncertain environment, clinicians can be more confident in advocating a course of action in their care of patients. And finally, knowledge that targeted therapy is possible suggests the potential for further innovation in treatment options. In fact, research continues to demonstrate options for targeted cetuximab treatment of mCRC at an even finer scale than seen with KRAS; and similar genetic targeting is being investigated, and advocated, in other cancer types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are generally viewed as the gold standard, results of one or even a series of trials may not accurately reflect the benefits experienced by an individual patient.  This case-study suggests that cetuximab initially appeared to have rather modest clinical benefits. Albeit, new information that became available and subsequent genetic subgroup assessments led to very different conclusions. Clinicians should be aware that the current knowledge is likely to evolve and any decisions about patient care should be carefully considered with that sense of uncertainty in mind. As in this case study, subgroup analyses (e.g., genetic subtypes) need a theoretical rationale. Ideally, the analyses should be determined at the time of original RCT design and should not just occur as explorations of the subsequent data. When improperly employed, post hoc analyses may lead to incorrect patient care conclusions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RCTs Tips for the CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*RCTs can determine whether an intervention can provide benefit in a very controlled environment.&lt;br /&gt;
&lt;br /&gt;
*The controlled nature of an RCT may limit its generalizability to a broader population.&lt;br /&gt;
&lt;br /&gt;
*No results are permanent; advances in scientific knowledge and understanding can influence how we view the effectiveness (or safety) of a therapeutic intervention.&lt;br /&gt;
&lt;br /&gt;
*Targeted therapy illuminated by carefully thought out subgroup analyses can improve the efficacious and safe use of an intervention.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 2: The Rosiglitazone Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-analysis&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often the results for the same intervention differ across clinical trials and it may not be clear whether one therapy provides more benefit than another. As CER increases and more studies are conducted, clinicians and policymakers are more likely to encounter this scenario. In a systematic review, a researcher identifies similar studies and displays their results in a table, enabling qualitative comparisons across the studies. With a meta-analysis, the data from included studies are statistically combined into a single “result.” Merging the data from a number of studies increases the effective sample size of the investigation, providing a statistically stronger conclusion about the body of research. By so doing, investigators may detect low frequency events and demonstrate more subtle distinctions between therapeutic alternatives.&lt;br /&gt;
&lt;br /&gt;
When studies have been properly identified and combined, the meta-analysis produces a summary estimate of the findings and a confidence interval that can serve as a benchmark in medical opinion and practice. However, when done incorrectly, the quantitative and statistical analysis can create impressive “numbers” but biased results. The following are important criteria for properly conducted meta-analyses:&lt;br /&gt;
&lt;br /&gt;
1.	Carefully defining unbiased inclusion or exclusion criteria for study selection&lt;br /&gt;
&lt;br /&gt;
2.	Including only those studies that have similar design elements, such as patient population, drug regimen, outcomes being assessed, and time-frame&lt;br /&gt;
&lt;br /&gt;
3.	Applying correct statistical methods to combine and analyze the data&lt;br /&gt;
&lt;br /&gt;
Reporting this information is essential for the reader to determine whether the data were suitable to combine, and if the meta-analysis draws unbiased conclusions. Meta-analyses of randomized clinical trials are considered to be the highest level of medical evidence as they are based upon a synthesis of rigorously controlled trials that systematically reduce bias and confounding. This technique is useful in summarizing available evidence and will likely become more common in the era of publicly funded comparative effectiveness research. The following case study will examine several key principles that will be useful as the reader encounters these publications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Application&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Heart disease is the leading cause of mortality in the United States, resulting in approximately 20% of all deaths. Diabetics are particularly susceptible to heart disease, with more than 65% of deaths attributable to it. The nonfatal complications of diabetes are wide-ranging and include kidney failure, nerve damage, amputation, stroke and blindness, among other outcomes. In 2007, the total estimated cost of diabetes in the United States was $174B; $116B was derived from direct medical expenditures and the rest from the indirect cost of lost productivity due to the disease. With such serious health effects and heavy direct and indirect costs tied to diabetes, proper disease management is critical. Historically, diabetes treatment has focused on strict blood sugar control, assuming that this goal not only targets diabetes but also reduces other serious comorbidities of the disease.&lt;br /&gt;
&lt;br /&gt;
Anti-diabetic agents have long been associated with key questions as to their benefits/risks in the treatment of diabetes. The sulfonylurea tolbutamide, a first generation anti-diabetic drug, was found in a landmark study in the 1970s to significantly increase the CV mortality rate compared to patients not on this agent. Further analysis by external parties concluded that the methods employed in this trial were significantly flawed (e.g., use of an “arbitrary” definition of diabetes status, heterogeneous baseline characteristics of the populations studied, and incorrect statistical methods). Since these early studies, CV concerns continue to be an issue with selected oral hypoglycemic agents that have subsequently entered the marketplace.&lt;br /&gt;
&lt;br /&gt;
A class of drugs, thiazolidinedione (TZD), was approved in the late 1990s, as a solution to the problems associated with the older generation of sulfonylureas. Rosiglitazone, a member of the TZD class, was approved by the FDA in 1999 and was widely prescribed for the treatment of type-2 diabetes. A number of RCTs supported the benefit of rosiglitazone as an important new oral antidiabetic agent. However, safety concerns developed as the FDA received reports of adverse cardiac events potentially associated with rosiglitazone. It was in this setting that a meta-analysis by Nissen and Wolski was published in the New England Journal of Medicine in June 2007.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nissen and Wolski conducted a meta-analysis examining the impact of rosiglitazone on cardiac events and mortality compared to alternative therapeutic approaches. The study began with a broad search to locate potential studies for review. The authors screened published phase II, III, and IV trials; the FDA website; and the drug manufacturer’s clinical-trial registry for applicable data relating to rosiglitazone use. When the initial search was complete, the studies were further categorized by pre-stated inclusion criteria. Meta-analysis inclusion criteria were simple: studies had to include rosiglitazone and a randomized comparator group treated with either another drug or placebo, study arms had to show similar length of treatment, and all groups had to have received more than 24 weeks of exposure to the study drugs. The studies had to contain outcome data of interest including the rate of myocardial infarction (MI) or death from all CV causes. Out of 116 studies surveyed by the authors, 42 met their inclusion criteria and were included in the meta-analysis. Of the studies they included, 23 had durations of 26 weeks or less, and only five studies followed patients for more than a year. Until this point, the study’s authors were following a path similar to that of any reviewer interested in CV outcomes, examining the results of these 42 studies and comparing them qualitatively. Quantitatively combining the data, however, required the authors to make choices about the studies they could merge and the statistical methods they should apply for analysis. Those decisions greatly influenced the results that were reported.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the studies were combined, the meta-analysis contained data from 15,565 patients in the rosiglitazone group and 12,282 patients as comparators. Analyzing their data, the authors chose one particular statistical method (the Peto odds ratio method, a fixed-effect statistical approach), which calculates the odds of events occurring where the outcomes of interest are rare and small in number. In comparing rosiglitazone with a “control” group that included other drugs or placebo, the authors reported odds ratios of 1.43 (95% CI, 1.03-1.98; P=0.03) and 1.64 (95% CI,&lt;br /&gt;
0.98-2.74; P=0.06) for MI and death from CV causes, respectively. In other words, the odds of an MI or death from a CV cause are higher for rosiglitazone patients than for patients on other therapies or placebo. The authors reported that rosiglitazone was significantly associated with an increase in the risk of MI and had borderline significance in increasing the risk of death from all CV causes. These findings appeared online on the same day that the FDA issued a safety alert regarding rosiglitazone. Discussion of the meta-analysis was immediately featured prominently in the news media. By December 2007, prescription claims for the drug at retail pharmacies had fallen by more than 50%.&lt;br /&gt;
&lt;br /&gt;
As diabetic patients and their clinicians reacted to the news, a methodologic debate also ensued. This discussion included statistical issues pertaining to the conduct of the analysis, its implications for clinical care, and finally the FDA and drug manufacturer’s roles in overseeing and regulating rosiglitazone. The concern among patients with diabetes regarding treatment, continues in the medical community today.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should the studies have been combined? Commentators faulted the authors for including several studies that were not originally intended to investigate diabetes, and for combining both placebo and drug therapy data into one comparator arm. Some critics noted that despite the stated inclusion criteria, some data were derived from studies where the rosiglitazone arm was allowed a longer follow-up than the comparator arm. By failing to account for this longer follow-up period, commentators felt that the authors may have overestimated the effect of rosiglitazone on CV outcomes. Many reviewers were concerned that this meta-analysis excluded trials in which no patients suffered an MI or died from CV causes – the outcomes of greatest interest. Some reviewers also noted that the exclusion of zero-event trials from the pooled dataset not only gave an incomplete picture of the impact of rosiglitazone but could have increased the odds ratio estimate. In general, the pooled dataset was criticized by many for being a faulty microcosm of the information available regarding rosiglitazone.&lt;br /&gt;
&lt;br /&gt;
It is essential that a meta-analysis be based on similarity in the data sources. If studies differ in important areas such as the patient populations, interventions, or outcomes, combining their data may not be suitable. The researchers accepted studies and populations that were clinically heterogeneous, yet pooled them as if they were not. The study reported that the results were combined from a number of trials that were not initially intended to investigate CV outcomes. Furthermore, the available data did not allow for time-to-event analysis, an essential tool in comparing the impact of alternative treatment options. Reviewers considered the data to be insufficiently homogeneous, and the line of cause and effect to be murkier than the authors described.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Were the statistical methods optimal?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The statistical methods for this meta-analysis also came under significant criticism. The critiques focused on the authors’ use of the Peto method as being an incorrect choice because data were pooled from both small and very large studies, resulting in a potential overestimation of treatment effect. Others reviewers pointed that the Peto method should not have been used, as a number of the underlying studies did not have patients assigned equally to rosiglitazone and comparator groups. Finally, critics suggested that the heterogeneity of the included studies required an altogether different set of analytic techniques.&lt;br /&gt;
&lt;br /&gt;
Demonstrating the sensitivity of the authors’ initial analysis to the inclusion criteria and statistical tests used, a number of researchers reworked the data from this study. one researcher used the same studies but analyzed the data with a more commonly used statistical method (Mantel-Haenszel), and found no significant increase in the relative risk or common odds ratio with MI or CV death. When the pool of studies was expanded to include those originally eliminated because they had zero CV events, the odds ratios for MI and death from CV causes dropped from 1.43 to 1.26 (95% CI, 0.93-1.72) and from 1.64 to 1.14 (95% CI, 0.74-1.74), respectively. Neither of the recalculated odd ratios were significant for MI or CV death. Finally, several newer long-term studies have been published since the Nissen meta-analysis. Incorporating their results with the meta-analysis data showed that rosiglitazone is associated with an increased risk of MI but not of CV death. Thus, the findings from these meta-analyses varied with the methods employed, the studies included, and the addition of later trials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The controversy surrounding the rosiglitazone meta-analysis authored by Nissen and Wolski forced an unplanned interim analysis of a long-term, randomized trial investigating the CV effects of rosiglitazone among patients with type 2 diabetes. The authors of the RECORD trial noted that even though the follow-up at 3.75 years was shorter than expected, rosiglitazone, when added to standard glucose-lowering therapy, was found to be associated with an increase in the risk of heart failure but was not associated with any increase in death from CV or other causes. Data at the time were found to be insufficient to determine the effect of rosiglitazone on an increase in the risk of MI. the final report of that trial, published in June 2009, confirmed the elevated risk of heart failure in people with type 2 diabetes treated with rosiglitazone in addition to glucose-lowering drugs, but continued to show inconclusive results about the effect of the drug therapy on the risk of MI. Further, the RECORD trial clarified that rosiglitazone does not result in an increased risk of CV morbidity or mortality compared to standard glucose-lowering drugs. Other trials conducted since the publishing of the meta-analysis have corroborated these results, casting further doubt on the findings of the meta-analysis published by Nissen and Wolski.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now what?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some sources suggest that the original Nissen meta-analysis delivered more harm than benefit, and that a well-recognized medical journal may have erred in its process of peer review. Despite this criticism, it is important to note that subsequent publications support the risk of adverse CV events associated with rosiglitazone, although rosiglitazone use does not appear to increase deaths. These results and emerging data point to the need for further rigorous research to clarify the benefits and risks of rosiglitazone on a variety of outcomes, and the importance of directing the drug to the population that will maximally benefit from its use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this Case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Results from initial randomized trials that seem definitive at one time may not be conclusive, as further trials may emerge to clarify, redirect, or negate previously accepted results. A meta-analysis of those trials can lead to varying results based upon the timing of the analysis and the choices made in its performance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Meta-Analysis: Tips for CER Practitioners&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The results of a meta-analysis are highly dependent on the studies included (and excluded). Are these criteria properly defined and relevant to the purposes of the meta-analysis? Were the combined studies sufficiently similar? Can results from this cohort be generalized to other populations of interest?&lt;br /&gt;
&lt;br /&gt;
*The statistical methodology can impact study results. Have there been reviews critiquing the methods used in the meta-analysis?&lt;br /&gt;
&lt;br /&gt;
*A variety of statistical tests should be considered, and perhaps reported, in the analysis of results. Do the authors mention their rationale in choosing a statistical method? Do they show the stability of their results across a spectrum of analytical methods?&lt;br /&gt;
&lt;br /&gt;
*Nothing is permanent. Emerging data may change the playing field, and meta- analysis results are only as good as the data and statistics from which they are derived.&lt;br /&gt;
&lt;br /&gt;
===Case-Study 3: The Nurses’ Health Study===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An observational study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An observational study is a very common type of research design in which the effects of a treatment or condition are studied without formally randomizing patients in an experimental design. Such studies can be done prospectively, wherein data are collected about a group of patients going forward in time; or retrospectively, in which the researcher looks into the past, mining existing databases for data that have already been collected. Latter studies are frequently performed by using an electronic database that contains, for example, administrative, “billing,” or claims data. Less commonly, observational research uses electronic health records, which have greater clinical information that more closely resembles the data collected in an RCT. Observational studies often take place in “real- world” environments, which allow researchers to collect data for a wide array of outcomes. Patients are not randomized in these studies, but the findings can be used to generate hypotheses for investigation in a more constrained experimental setting. Perhaps the best known observational study is the “Framingham study,” which collected demographic and health data for a group of individuals over many years (and continues to do so) and has provided an understanding of the key risk factors for heart disease and stroke.&lt;br /&gt;
&lt;br /&gt;
Observational studies present many advantages to the comparative effectiveness researcher. the study design can provide a unique glimpse of the use of a health care intervention in the “real world,” an essential step in gauging the gap between efficacy (can a treatment work in a controlled setting?) and effectiveness (does the treatment work in a real-life situation?). Furthermore, observational studies can be conducted at low cost, particularly if they involve the secondary analysis of existing data sources. CER often uses administrative databases, which are based upon the billing data submitted by providers during routine care. These databases typically have limited clinical information, may have errors in them, and generally do not undergo auditing.&lt;br /&gt;
&lt;br /&gt;
The uncontrolled nature of observational studies allows them to be subject to bias and confounding. For example, doctors may prescribe a new medication only for the sickest patients. Comparing these outcomes (without careful statistical adjustment) with those from less ill patients receiving alternative treatment may lead to misleading results. Observational studies can identify important associations but cannot prove cause and effect. These studies can generate hypotheses that may require RCTs for fuller demonstration of those relationships. Secondary analysis can also be problematic if researchers overwork datasets by doing multiple exploratory analyses (e.g., data-dredging): the more we look, the more we find, even if those findings are merely statistical aberrations. Unfortunately, the growing need for CER and the wide availability of administrative databases may lead to selection of research of poor quality with inaccurate findings.&lt;br /&gt;
&lt;br /&gt;
In comparative effectiveness research, observational studies are typically considered to be less conclusive than RCTs and meta-analyses. Nonetheless, they can be useful, especially because they examine typical care. Due to lower cost and improvements in health information, observational studies will become increasingly common. Critical assessment of whether the described results are helpful or biased (based upon how the study was performed) are necessary. This case will illustrate several characteristics of the types of studies that will assist in evaluating newly published work. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Clinical Applications&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cardiovascular diseases (CVD) are the leading cause of death in women older than   the age of 50. Epidemiologic evidence suggests that estrogen is a key mediator in the development of CVD. Estrogen is an ovarian hormone whose production decreases as women approach menopause. The steep increase in CVD in women at menopause and older and in women who have had hysterectomies further supports a relationship between estrogen and CVD. Building on this evidence of biologic plausibility, epidemiological and observational studies suggested that estrogen replacement therapy (a form of &amp;lt;b&amp;gt;hormone replacement therapy&amp;lt;/b&amp;gt;, or HRT) had positive effects on the risk of CVD in postmenopausal women, (albeit with some negative effects in its potential to increase the risk for breast cancer and stroke). Based on these findings, in the 1980s and 1990s HRT was routinely employed to treat menopausal symptoms and serve as prophylaxis against CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was done?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nurses’ Health Study (NHS) began collecting data in 1976. In the study, researchers intended to examine a broad range of health effects in women over a long period of time, and a key goal was to clarify the role of HRT in heart disease. The cohort (i.e., the group being followed) included married registered nurses aged 30-55 in 1976 who lived in the 11 most populous states. To collect data, the researchers mailed the study participants a survey every 2 years that asked questions about topics such as smoking, hormone use, menopausal status, and less frequently, diet. Data were collected for key end points that included MI, coronary-artery bypass grafting or angioplasty, stroke, total CVD mortality, and deaths from all causes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What was found?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At a 10-year follow-up point, the NHS had a study pool of 48,470 women. The researchers found that estrogen use (alone, without progestin) in postmenopausal women was associated with a reduction in the incidence of CVD as well as in CVD mortality compared to non-users. Later, estrogen-progestin combination therapy was shown to be even more cardioprotective than estrogen monotherapy, and lower doses of estrogen replacement therapy were found to deliver equal cardioprotection and lower the risk for adverse events. NHS researchers were alert to the potential for bias in observational studies. Adjustment for risk factors such as age (a typical practice to eliminate confounding) did not change the reported findings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Was this the right answer?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NHS was not unique in reporting the benefits associated with HRT; other observational studies corroborated the NHS findings. A secondary retrospective data analysis of the UK primary care electronic medical record database, for example, also showed the protective effect associated with HRT use. Researchers were aware of the fundamental limitations of observational studies, particularly with regard to selection bias. They and practicing clinicians were also aware of the potential negative health effects of HRT, which had to be constantly weighed against the potential cardioprotective benefits in deciding a patient’s course of treatment. As a large section of the population could experience the health effects of HRT, researchers began planning RCTs to verify the promising observational study results. It was highly anticipated that those RCTs would corroborate the belief that estrogen replacement can reduce CVD risk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Randomized Controlled Trial: The Women’s Health Initiative&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Women’s health Initiative (WHI) was a major study established by the National Institutes of health in 1992 to assess a broad range of health effects in postmenopausal women. The trial was intended to follow these women for 8 years, at a cost of millions of dollars in federal funding. Among its many facets, it included an RCT to confirm the results from the observational studies discussed above. To fully investigate earlier findings, the WHI had two subgroups. One subgroup consisted of women with prior hysterectomies; they received estrogen monotherapy. The second group consisted of women who had not undergone hysterectomy; they received estrogen in combination with progestin. The WHI enrolled 27,347 women in their HRT investigation: 10,739 in the estrogen-alone arm and 16,608 in the estrogen plus progestin arm. Within each arm, women were randomly assigned to receive either HRT or placebo. All women in the trial were postmenopausal and aged 50-79 years; the mean age was 63.6 years (a fact that would be important in later analysis). Some participants had experienced previous CV events. The primary outcome of both subgroups was coronary heart disease (CHD), as described by nonfatal MI or death due to CHD.&lt;br /&gt;
&lt;br /&gt;
The estrogen-progestin arm of the WHI was halted after a mean follow-up of 5.2 years, 3 years earlier than expected, as the HRT users in this arm were found to be at increased risk for CHD compared to those who received placebo. The study also noted elevated rates of breast cancer and stroke, among other poor outcomes. The estrogen-alone arm continued for an average follow-up of 6.8 years before being similarly discontinued ahead of schedule. Although this part of the study did not find an increased risk of CHD, it also did not find any cardioprotective effect. Beyond failing to locate any clear CV benefits, the WHI also found real evidence of harm, including increased risk of blood clots, breast cancer and stroke. Initial WHI publications therefore recommended against HRT being prescribed for the secondary prevention of CVD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What Next?&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scientists and the clinicians who relied on their data for guidance in treating patients, were faced with conflicting data: epidemiological and observational studies suggested that HRT was cardioprotective while the higher-quality evidence from RCTs strongly suggested the opposite. Clinicians primarily followed the WHI results, so prescriptions for HRT in postmenopausal women quickly declined. Meanwhile, researchers began to analyze the studies for potential discrepancies, and found that the women being followed in the NHS and the WHI differed in several important characteristics.&lt;br /&gt;
&lt;br /&gt;
First, the WHI population was older than the NHS cohort, and many had entered menopause at least 10 years before they enrolled in the RCT. Thus, the WHI enrollees experienced a long duration from the onset of menopause to the commencement of HRT. At the same time, many in the NHS population were closer to the onset of menopause and were still displaying hormonal symptoms when they began HRT. Second, although the NHS researchers adjusted the data for various confounding effects, their results could still have been subject to bias. In general, the NHS cohort was more highly educated and of a higher socioeconomic status than the WHI participants, and therefore more likely to see a physician regularly. The NHS women were also leaner and generally healthier than their RCT counterparts, and had been selected for their evident lack of pre-existing CV conditions. This selection bias in the NHS enrollment may have led to a “healthy woman” effect that in turn led to an overestimation of the benefits of therapy in the observational study. Third, researchers noted that dosing differences between the two study types may have contributed to the divergent results. The NHS reported beneficial results following low-dose estrogen therapy. The WHL, meanwhile, used a higher estrogen dose, exposing women to a larger dosage of hormones and increasing their risk for adverse events. The increased risk profile of the WHI women (e.g., older, more comorbidities, higher estrogen dose) could have contributed to the evidence of harm seen in the WHI results.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Emerging Data&amp;lt;/b&amp;gt;&lt;br /&gt;
In addition to identifying the inherent differences between the two study populations, researchers began a secondary analysis of the NHS and WHI trials. NHS researchers reported that women who began HRT close to the onset of menopause had a significantly reduced risk of CHD. In the subgroups of women that were older and had a similar duration after menopause compared with the WHI women, they found no significant relationship between HRT and CHD. Also, the WHI study further stratified these results by age, and found that women who began HRT close to their onset of menopause experienced some cardioprotection, while women who were further from the onset of menopause had a slightly elevated risk for CHD.&lt;br /&gt;
&lt;br /&gt;
Secondary analysis of both studies was therefore necessary to show that age and a short duration from the onset of menopause are crucial to HRT success as a cardioprotective agent. Neither study type provided “truth” or rather, both studies provided “truth” if viewed carefully (e.g., both produced valid and important results). The differences seen in the studies were rooted in the timing of HRT and the populations being studied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Lessons Learned From this case Study&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although RCTs are given a higher evidence grade, observational studies provide important clinical insights. In this example, the study populations differed. For policymakers and clinicians, it is crucial to examine whether the CER was based upon patients similar to those being considered. Any study with a dissimilar population may provide non-relevant results. Thus, readers of CER need to carefully examine the generalizability of the findings being reported.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
General Classification and Regression Tree (CART) data analysis steps part of the R package &amp;lt;b&amp;gt;rpart.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Growing the Tree===&lt;br /&gt;
&lt;br /&gt;
 # To grow a tree, use&lt;br /&gt;
 rpart(formula, data=, method=,control=), where&lt;br /&gt;
 formula 	is in the format outcome ~ predictor1+predictor2+...&lt;br /&gt;
 data= 	specifies the data frame&lt;br /&gt;
 method= 	&amp;quot;class&amp;quot; for a classification tree, use &amp;quot;anova&amp;quot; for a regression tree&lt;br /&gt;
 control= 	optional parameters for controlling tree growth. For example, control=rpart.control(minsplit=30, cp=0.001) requires that the minimum number of observations in a node be 30 before attempting a split and that a split      must decrease the overall lack of fit by a factor of 0.001 (cost complexity factor) before being attempted.&lt;br /&gt;
&lt;br /&gt;
===Examining Results===&lt;br /&gt;
&lt;br /&gt;
 # These functions help with examining the results.&lt;br /&gt;
 printcp(fit) 	display complexity parameter (cp) table&lt;br /&gt;
 plotcp(fit) 	plot cross-validation results&lt;br /&gt;
 rsq.rpart(fit) 	plot approximate R-squared and relative error for different splits (2 plots). labels are only appropriate for the &amp;quot;anova&amp;quot; method.&lt;br /&gt;
 print(fit) 		print results&lt;br /&gt;
 summary(fit) 	detailed results including surrogate splits&lt;br /&gt;
 plot(fit) 		plot decision tree&lt;br /&gt;
 text(fit) 		label the decision tree plot&lt;br /&gt;
 post(fit, file=) 	create postscript plot of decision tree&lt;br /&gt;
 # In trees created by rpart(), move to the LEFT branch when the stated condition is true.&lt;br /&gt;
&lt;br /&gt;
===Pruning Trees===&lt;br /&gt;
&lt;br /&gt;
 #In general, trees should be pruned back to avoid overfitting the data. The tree size should minimize the cross-#validated error – xerror column printed by printcp(). Pruning the tree is accomplished by:&lt;br /&gt;
 prune(fit, cp= )&lt;br /&gt;
 # use printcp( ) to examine the cross-validation error results, select the complexity parameter (CP) associated with minimum error, and insert the CP it into the prune() function. This (automatically selecting the complexity  parameter associated with the smallest cross-validated error) can be done succinctly by:&lt;br /&gt;
 fit$\$$cptable[which.min(fit$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
===Compete Dataset for N-of-1 Example===&lt;br /&gt;
[[SMHS_MethodsHeterogeneity_CER_Nof1|This N-of-1 Dataset]] includes an example.&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_CER}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16221</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16221"/>
		<updated>2016-05-23T18:55:03Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Nonparametric Regression Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Income-Food Expenditure Example:&amp;lt;/b&amp;gt; Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income)&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt;. We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Canadian Wage Data Example:&amp;lt;/b&amp;gt; Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  &amp;lt;mark&amp;gt;0.2308&amp;lt;/mark&amp;gt;,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt; http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
*&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt; http://www.ers.usda.gov/media/200576/err32c_1_.pdf&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16220</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16220"/>
		<updated>2016-05-23T18:53:40Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Nonparametric Regression Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Income-Food Expenditure Example:&amp;lt;/b&amp;gt; Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income)&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt;. We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Canadian Wage Data Example:&amp;lt;/b&amp;gt; Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt; http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
*&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt; http://www.ers.usda.gov/media/200576/err32c_1_.pdf&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16219</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16219"/>
		<updated>2016-05-23T18:52:37Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Quantile Treatment Effect (QTE) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Income-Food Expenditure Example:&amp;lt;/b&amp;gt; Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income)&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt;. We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt; http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
*&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt; http://www.ers.usda.gov/media/200576/err32c_1_.pdf&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16218</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16218"/>
		<updated>2016-05-23T18:52:00Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income)&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt;. We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt; http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
*&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt; http://www.ers.usda.gov/media/200576/err32c_1_.pdf&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16217</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16217"/>
		<updated>2016-05-23T18:51:35Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Quantile Treatment Effect (QTE) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income)&amp;lt;sup&amp;gt;11&amp;lt;/sup&amp;gt;. We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;  http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16216</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16216"/>
		<updated>2016-05-23T18:48:36Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
*&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
*&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;  http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16215</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16215"/>
		<updated>2016-05-23T18:48:14Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt; http://effectivehealthcare.ahrq.gov/search-for-guides-reviews-and-reports/?pageaction=displayproduct&amp;amp;productID=1857 &lt;br /&gt;
&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;  http://jpepsy.oxfordjournals.org/content/39/2/138.full#sec-14&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16214</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16214"/>
		<updated>2016-05-23T18:47:39Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Series of “N of 1” trials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design&amp;lt;sup&amp;gt;9&amp;lt;/sup&amp;gt;. For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16213</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16213"/>
		<updated>2016-05-23T18:47:08Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design  . For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16212</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16212"/>
		<updated>2016-05-23T18:45:31Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Simulation Example 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the ''I''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design  . For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16211</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16211"/>
		<updated>2016-05-23T18:44:03Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Predictive risk models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the I2 test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design  . For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; http://onlinelibrary.wiley.com/enhanced/doi/10.1002/jrsm.54&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16210</id>
		<title>SMHS MethodsHeterogeneity MetaAnalysis</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_MetaAnalysis&amp;diff=16210"/>
		<updated>2016-05-23T18:43:21Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Meta-analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Meta-Analyses ==&lt;br /&gt;
&lt;br /&gt;
==Meta-analysis==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Meta-analysis is an approach to combine treatment effects across trials or studies into an aggregated treatment effect with higher statistical power than observed in each individual trials. It may detect HTE by testing for differences in treatment effects across similar RCTs. It requires that the individual treatment effects are similar to ensure pooling is meaningful. In the presence of large clinical or methodological differences between the trials, it may be to avoid meta-analyses. The presence of HTE across studies in a meta-analysis may be due to differences in the design or execution of the individual trials (e.g., randomization methods, patient selection criteria). &amp;lt;b&amp;gt;Cochran's Q is a methods for detection of heterogeneity, which is computed as the weighted sum of squared differences between each study's treatment effect and the pooled effects across the studies.&amp;lt;/b&amp;gt; It is a barometer of inter-trial differences impacting the observed study result.  A possible source of error in a meta-analysis is publication bias. Trial size may introduce publication bias since larger trials are more likely to be published. Language and accessibility represent other potential confounding factors. When the heterogeneity is not due to poor study design, it may be useful to optimize the treatment benefits for different cohorts of participants.	&lt;br /&gt;
&lt;br /&gt;
Cochran's Q statistics is the weighted sum of squares on a standardized scale&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;. &amp;lt;b&amp;gt;The corresponding P value indicates the strength of the evidence of presence of heterogeneity.&amp;lt;/b&amp;gt; This test may have low power to detect heterogeneity sometimes and it is suggested to use a value of 0.10 as a cut-off for significance (Higgins et al., 2003). The Q statistics also may have too much power as a test of heterogeneity when the number of studies is large.&lt;br /&gt;
&lt;br /&gt;
===Simulation Example 1===&lt;br /&gt;
&lt;br /&gt;
 # Install and Load library&lt;br /&gt;
 install.packages(&amp;quot;meta&amp;quot;)&lt;br /&gt;
 library(meta)&lt;br /&gt;
 &lt;br /&gt;
 # Set number of studies&lt;br /&gt;
 n.studies = 15&lt;br /&gt;
 &lt;br /&gt;
 # number of treatments: case1, case2, control&lt;br /&gt;
 n.trt = 3&lt;br /&gt;
 &lt;br /&gt;
 # number of outcomes&lt;br /&gt;
 n.event = 2&lt;br /&gt;
 &lt;br /&gt;
 # simulate the (balanced) number of cases (case1 and case2) and controls in each study&lt;br /&gt;
 ctl.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case1.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
 case2.group = rbinom(n = n.studies, size = 200, prob = 0.3)&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of outcome events (e.g., deaths) and no events in the control group&lt;br /&gt;
 event.ctl.group = rbinom(n = n.studies, size = ctl.group, prob = rep(&amp;lt;mark&amp;gt;0.1&amp;lt;/mark&amp;gt;, length(ctl.group)))&lt;br /&gt;
 noevent.ctl.group = ctl.group - event.ctl.group&lt;br /&gt;
 &lt;br /&gt;
 # Simulate the number of events and no events in the case1 group&lt;br /&gt;
 event.case1.group = rbinom(n = n.studies, size = case1.group, prob = rep(&amp;lt;mark&amp;gt;0.5&amp;lt;/mark&amp;gt;, length(case1.group)))&lt;br /&gt;
 noevent.case1.group = case1.group - event.case1.group&lt;br /&gt;
&lt;br /&gt;
 # Simulate the number of events and no events in the case2 group&lt;br /&gt;
 event.case2.group = rbinom(n = n.studies, size = case2.group, prob = rep(&amp;lt;mark&amp;gt;0.6&amp;lt;/mark&amp;gt;, length(case2.group)))&lt;br /&gt;
 noevent.case2.group = case2.group - event.case2.group&lt;br /&gt;
&lt;br /&gt;
 # Run the univariate meta-analysis using &amp;lt;b&amp;gt;metabin()&amp;lt;/b&amp;gt;, Meta-analysis of binary outcome data – &lt;br /&gt;
 # Calculation of fixed and random effects estimates (risk ratio, odds ratio, risk difference or arcsine&lt;br /&gt;
 # difference) for meta-analyses with binary outcome data.   Mantel-Haenszel (MH), &lt;br /&gt;
 #  inverse variance and Peto method are available for pooling.&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;b&amp;gt;method&amp;lt;/b&amp;gt; = A character string indicating which method is to be used for pooling of studies. &lt;br /&gt;
 # one of &amp;quot;MH&amp;quot; , &amp;quot;Inverse&amp;quot; , or &amp;quot;Cochran&amp;quot;&lt;br /&gt;
 # sm = A character string indicating which summary measure (“OR”, &amp;quot;RR&amp;quot; &amp;quot;RD&amp;quot;=risk difference) is to be &lt;br /&gt;
 # used for pooling of studies&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case1, n.e and n.c are numbers in experimental and control groups&lt;br /&gt;
 meta.ctr_case1 &amp;lt;- metabin(event.e = &amp;lt;b&amp;gt;event.case1.group&amp;lt;/b&amp;gt;, n.e = case1.group, event.c = &amp;lt;b&amp;gt;event.ctl.group&amp;lt;/b&amp;gt;, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 # in this case we use Odds Ratio, of the odds of death in the experimental and control studies&lt;br /&gt;
 forest(meta.ctr_case1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods8.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Control vs. Case2&lt;br /&gt;
 meta.ctr_case2 &amp;lt;- metabin(event.e = event.case2.group, n.e = case2.group, event.c = event.ctl.group, &lt;br /&gt;
 n.c = ctl.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.ctr_case2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods9.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Case1 vs. Case2&lt;br /&gt;
 meta.case1_case2 &amp;lt;- metabin(event.e = event.case1.group, n.e = case1.group, event.c = event.case2.group, &lt;br /&gt;
 n.c = case2.group, method = &amp;quot;MH&amp;quot;, sm = &amp;quot;OR&amp;quot;)&lt;br /&gt;
 forest(meta.case1_case2)&lt;br /&gt;
 summary(meta.case1_case2)&lt;br /&gt;
&lt;br /&gt;
 Test of heterogeneity:&lt;br /&gt;
     Q 	d.f.  	p-value&lt;br /&gt;
 11.99   	14   	0.6071&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods10.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;forest plo&amp;lt;/b&amp;gt;t shows the I2 test indicates the evidence to reject the null hypothesis (no study heterogeneity and the fixed effects model should be used).&lt;br /&gt;
&lt;br /&gt;
==Series of “N of 1” trials==&lt;br /&gt;
&lt;br /&gt;
This technique combines (a “series of”) n-of-1 trial data to identify HTE. An n-of-1 trial is a repeated crossover trial for a single patient, which randomly assigns the patient to one treatment vs. another for a given time period, after which the patient is re-randomized to treatment for the next time period, usually repeated for 4-6 time periods. Such trials are most feasibly done in chronic conditions, where little or no washout period is needed between treatments and treatment effects are identifiable in the short-term, such as pain or reliable surrogate markers. Combining data from identical n-of-1 trials across a set of patients enables the statistical analysis controlling for patient fixed or random effects, covariates, centers, or sequence effects, see &amp;lt;b&amp;gt;Figure&amp;lt;/b&amp;gt; below. These combined trials are often analyzed within a Bayesian context using shrinkage estimators that combine individual and group mean treatment effects to create a “posterior” individual mean treatment effect estimate which is a form of inverse variance-weighted average of the individual and group effects. Such trials are typically more expensive than standard RCTs on a per-patient basis, however, they require much smaller sample sizes, often less than 100 patients (due to the efficient individual-as-own-control design), and create individual treatment effect estimates that are not possible in a non-crossover design  . For the individual patient, the treatment effect can be re-estimated after each time period, and the trial stopped at any point when the more effective treatment is identified with reasonable statistical certainty.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
A study involving 8 participants collected data across 30 days, in which 15 treatment days and 15 control days are randomly assigned within each participant. The treatment effect is represented as a binary variable (control day=0; treatment day=1). The outcome variable represents the response to the intervention within each of the 8 participants. Study employed a fixed-effects modeling. By creating N − 1 dummy-coded variables representing the N=8 participants, where the last (i=8) participant serves as the reference (i.e., as the model intercept). So, each dummy-coded variable represents the difference between each participant (i) and the 8th participant. Thus, all other patients' values will be relative to the values of the 8th (reference) subject. The overall differences across participants in fixed effects can be evaluated with multiple &amp;lt;b&amp;gt;degree-of-freedom F-tests.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods11.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt; Complete data is available in the &amp;lt;b&amp;gt;Appendix.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Data Summary&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||Constant&lt;br /&gt;
|-&lt;br /&gt;
|Physical Activity||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|Intervention||Tx&lt;br /&gt;
|-&lt;br /&gt;
|WP Social Support||WPSS&lt;br /&gt;
|-&lt;br /&gt;
|PM Social Support (1-3)||PMss3&lt;br /&gt;
|-&lt;br /&gt;
|Self Efficacy||SelfEff25&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
 Nof1 &amp;lt;-read.table(&amp;quot;https://umich.instructure.com/files/330385/download?download_frd=1&amp;amp;verifier=DwJUGSd6t24dvK7uYmzA2aDyzlmsohyaK6P7jK0Q&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)    # 02_Nof1_Data.csv&lt;br /&gt;
 attach(Nof1)&lt;br /&gt;
 head(Nof1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID||Day||Tx||SelfEff||SelfEff25||WPSS||SocSuppt||PMss||PMss3||PhyAct&lt;br /&gt;
|-&lt;br /&gt;
|1||1||1||1||33||8||0.97||5.00||4.03||1.03||53&lt;br /&gt;
|-&lt;br /&gt;
|2||1||2||1||33||8||-0.17||3.87||4.03||1.03||73&lt;br /&gt;
|-&lt;br /&gt;
|3||1||3||0||33||8||0.81||4.84||4.03||1.03||23&lt;br /&gt;
|-&lt;br /&gt;
|4||1||4||0||33||8||-0.41||3.62||4.03||1.03||36&lt;br /&gt;
|-&lt;br /&gt;
|5||1||5||1||33||8||0.59||4.62||4.03||1.03||21&lt;br /&gt;
|-&lt;br /&gt;
|6||1||6||1||33||8||-1.16||2.87||4.03||1.03||0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 df.1 = data.frame(PhyAct, Tx, WPSS, PMss3, SelfEff25) &lt;br /&gt;
&lt;br /&gt;
 # library(&amp;quot;lme4&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 lm.1 = model.lmer &amp;lt;- lmer(PhyAct ~ Tx + SelfEff + Tx*SelfEff + (1|Day) + (1|ID) , data= df.1)&lt;br /&gt;
 summary(lm.1)&lt;br /&gt;
&lt;br /&gt;
 Linear mixed model fit by REML ['lmerMod']&lt;br /&gt;
 Formula: PhyAct ~ Tx + SelfEff + Tx * SelfEff + (1 | Day) + (1 | ID)&lt;br /&gt;
   Data: df.1&lt;br /&gt;
&lt;br /&gt;
 REML criterion at convergence: 8820&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Scaled Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Min||1Q||Median||3Q||Max&lt;br /&gt;
|-&lt;br /&gt;
|-2.7012||-0.6833||-0.0333||0.6542||3.9612&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Random Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Groups ||Name||Variance ||Std.Dev.&lt;br /&gt;
|-&lt;br /&gt;
| Day||(Intercept) ||0.0 || 0.00   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|ID|| (Intercept)||601.5||24.53   &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
 |Residual|| ||969.0 ||31.13  &lt;br /&gt;
|}&lt;br /&gt;
Number of obs: 900, groups:  Day, 30; ID, 30&lt;br /&gt;
 &amp;lt;/center&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Estimate||Std.||Error||t value&lt;br /&gt;
|-&lt;br /&gt;
|(Intercept)||38.3772||14.4738||2.651&lt;br /&gt;
|-&lt;br /&gt;
|Tx||4.0283||6.3745||0.632&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff||0.5818||0.5942||0.979&lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff||0.9702||0.2617||3.708&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Correlation of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||(Intr)||Tx ||SlfEff&lt;br /&gt;
|-&lt;br /&gt;
| Tx|| -0.220|| ||               &lt;br /&gt;
|-&lt;br /&gt;
| SelfEff||-0.946 ||0.208 ||     &lt;br /&gt;
|-&lt;br /&gt;
| Tx:SelfEff ||0.208 ||-0.946 ||-0.220&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Model:  PhyAct = Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25 + ε&lt;br /&gt;
 lm.2 = lm(PhyAct ~ Tx + WPSS + PMss3 + Tx*WPSS + Tx*PMss3 + SelfEff25 + Tx*SelfEff25, df.1) &lt;br /&gt;
 summary(lm.2)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = PhyAct ~ Tx + WPSS + PMss3 + Tx * WPSS + Tx * PMss3 + &lt;br /&gt;
    SelfEff25 + Tx * SelfEff25, data = df.1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Residuals&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Min||1Q||Median||3Q||Max               &lt;br /&gt;
|-&lt;br /&gt;
| -102.39||-28.24||-1.47||25.16||122.41    &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||52.0067||1.8080||28.764||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Tx||27.7366||2.5569||10.848||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|WPSS||1.9631||2.4272||0.809||0.418853 &lt;br /&gt;
|-   &lt;br /&gt;
|PMss3||13.5110||2.7853||4.851||1.45e-06 ***&lt;br /&gt;
|-&lt;br /&gt;
|SelfEff25||0.6289||0.2205||2.852||0.004439 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:WPSS||9.9114||3.4320||2.888||0.003971 ** &lt;br /&gt;
|-&lt;br /&gt;
|Tx:PMss3||8.8422||3.9390||2.245||0.025025 *  &lt;br /&gt;
|-&lt;br /&gt;
|Tx:SelfEff25||1.0460||0.3118||3.354||0.000829 ***&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Using SAS (StudyI_Analyses.sas, StudyIIab_Analyses.sas)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Type 3 Tests of Fixed Effects&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Effect&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Num DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;Den DF&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;F Value&amp;lt;/b&amp;gt;||&amp;lt;b&amp;gt;$Pr&amp;gt;F$&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx&amp;lt;/b&amp;gt;||1||224||67.46||&amp;lt;.0001          &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;||7||224||25.95||&amp;lt;.0001&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;Tx*ID&amp;lt;/b&amp;gt;||7||224||2.92||0.0060&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quantile Treatment Effect (QTE)==&lt;br /&gt;
&lt;br /&gt;
QTE employs quantile regression estimation (QRE) to examine the central tendency and statistical dispersion of the treatment effect in a population. These may not be revealed by the conventional mean estimation in RCTs. For instance, patients with different comorbidity scores may respond differently to a treatment. Quantile regression has the ability to reveal HTE according to the ranking of patients’ comorbidity scores or some other relevant covariate by which patients may be ranked. Therefore, in an attempt to inform patient-centered care, quantile regression provides more information on the distribution of the treatment effect than typical conditional mean treatment effect estimation. QTE characterizes the heterogeneous treatment effect on individuals and groups across various positions in the distributions of different outcomes of interest. This unique feature has given quantile regression analysis substantial attention and has been employed across a wide range of applications, particularly when evaluating the economic effects of welfare reform.&lt;br /&gt;
&lt;br /&gt;
One caveat of applying QRE in clinical trials for examining HTE is that the QTE doesn’t demonstrate the treatment effect for a given patient. Instead, it focuses on the treatment effect among subjects within the qth quantile, such as those who are exactly at the top 10th percent in terms of blood pressure or a depression score for some covariate of interest, for example, comorbidity score. It is not uncommon for the qth quantiles to be two different sets of patients before and after the treatment. For this reason, we have to assume that these two groups of patients are homogeneous if they were in the same quantiles.&lt;br /&gt;
&lt;br /&gt;
Income-Food Expenditure Example: Let’s examine the Engel data (N=235) on the relationship between food expenditure (foodexp) and household income (income). We can plot the data and then explore the superposition of the six fitted quantile regression lines. &lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;quantreg&amp;quot;)&lt;br /&gt;
 library(quantreg)&lt;br /&gt;
 data(engel)&lt;br /&gt;
 attach(engel)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;head(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|1||420.1577||255.8394&lt;br /&gt;
|-&lt;br /&gt;
|2||541.4117||310.9587&lt;br /&gt;
|-&lt;br /&gt;
|3||901.1575||485.6800&lt;br /&gt;
|-   &lt;br /&gt;
|4||639.0802||402.9974&lt;br /&gt;
|-&lt;br /&gt;
|5||750.8756||495.5608&lt;br /&gt;
|-&lt;br /&gt;
|6||945.7989||633.7978&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;summary(engel)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Income||Foodexp&lt;br /&gt;
|-   &lt;br /&gt;
|Min||377.1||242.3&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.||638.9||429.7&lt;br /&gt;
|-&lt;br /&gt;
|Median||884.0||582.5&lt;br /&gt;
|-   &lt;br /&gt;
|Mean||982.5||624.2&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.||1164.0||743.9&lt;br /&gt;
|-&lt;br /&gt;
|Max||4957.8||2032.7&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; be a real valued random variable with cumulative distribution function F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)=P(Y≤ y), then the τ-quantile of &amp;lt;i&amp;gt;Y&amp;lt;/i&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt; Q&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(τ)=F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;(τ)=inf{ y:F&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt;(y)≥τ} &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 0≤τ≤1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods12.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (1) Graphics&lt;br /&gt;
 plot(income, foodexp, cex=.25, type=&amp;quot;n&amp;quot;, xlab=&amp;quot;Household Income&amp;quot;, ylab=&amp;quot;Food Expenditure&amp;quot;)&lt;br /&gt;
 points(income, foodexp, cex=.5, col=&amp;quot;blue&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # tau - the quantile(s) to be estimated, in the range from 0 to 1. An object &amp;quot;rq.process&amp;quot; and an object &amp;quot;rqs&amp;quot; &lt;br /&gt;
 # are returned containing the matrix of coefficient estimates at the specified quantiles.&lt;br /&gt;
 abline( rq(foodexp ~ income, tau=.5), col=&amp;quot;blue&amp;quot;)  	# Quantile Regression Model&lt;br /&gt;
&lt;br /&gt;
 abline( lm(foodexp ~ income), lty=2, lwd=3, col=&amp;quot;red&amp;quot;) 	# linear model&lt;br /&gt;
 taus &amp;lt;- c(0.05, 0.1, 0.25, 0.75, 0.90, 0.95)&lt;br /&gt;
 colors &amp;lt;- rainbow(length(taus))&lt;br /&gt;
&lt;br /&gt;
 models &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector of models to store QR for diff taus&lt;br /&gt;
 model.names &amp;lt;- vector(mode = &amp;quot;list&amp;quot;, length = length(taus)) # define a vector model names&lt;br /&gt;
&lt;br /&gt;
 for( i in 1:length(taus)){&lt;br /&gt;
 models[[i]] &amp;lt;-  rq(foodexp ~ income, tau=taus[i]) &lt;br /&gt;
 var &amp;lt;- taus[i]&lt;br /&gt;
 model.names[[i]] &amp;lt;- paste(&amp;quot;Model [&amp;quot;, i , &amp;quot;]: tau=&amp;quot;, var)&lt;br /&gt;
 abline( models[[i]], lwd=2, col= colors[[i]])&lt;br /&gt;
 }&lt;br /&gt;
 legend(3000, 1100, model.names, col= colors, pch= taus, bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods13.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # (2) Inference about quantile regression coefficients.  As an alternative to the rank-inversion confidence intervals, we can obtain a table of coefficients, standard errors, t-statistics, and p-values using the summary function:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;summary(models[[3]], se = &amp;quot;nid&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Alternatively, we can use summary.rq to compute bootstrapped standard errors.&lt;br /&gt;
 summary.rq(models[[3]], se = &amp;quot;nid&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Call: rq(formula = foodexp ~ income, tau = taus[i])&lt;br /&gt;
 tau: [1] 0.25&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|||Value||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||95.48354||21.39237||4.46344||0.00001&lt;br /&gt;
|-&lt;br /&gt;
|Income||0.47410||0.02906||16.31729||0.00000&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Nonparametric Regression Methods ==&lt;br /&gt;
&lt;br /&gt;
Nonparametric regression enables dealing with HTE in RCTs. Different nonparametric methods, such as kernel smoothing methods and series methods, can be used to generate test statistics for examining the presence of HTE. A kernel method is a weighting scheme based on a kernel function (e.g. uniform, Gaussian). When evaluating the treatment effect of a patient in RCTs, the kernel method assigns larger weights to those observations with similar covariates. This is done because it is assumed that patients with similar covariates provide more relevant data on predicted treatment response. Examining participants that have different backgrounds (e.g., demographic, clinical), kernel smoothing methods utilize information from highly divergent participants when estimating a particular subject’s treatment effect. Lower weights are assigned to very different subjects and the kernel methods require choosing a set of smoothing parameters to group patients according to their relative degree of similarities. A drawback is that the corresponding proposed test statistics may be sensitive to the chosen bandwidths, which inhibits the interpretation of the results. Series methods use approximating functions (splines or power series of the explanatory variables) to construct test statistics. Compared to kernel smoothing methods, series methods normally have the advantage of computational convenience; however, the precision of test statistics depends on the number of terms selected in the series. &lt;br /&gt;
&lt;br /&gt;
Canadian Wage Data Example: Nonparametric regression extends the classical parametric regression (e.g., lm, lmer) involving one continuous dependent variable, y, and (1 or more) continuous explanatory variable(s), x. Let’s start with a popular parametric model of a wage equation that we can extend to a fully nonparametric regression model. First, we will compare and contrast the parametric and nonparametric approach towards univariate regression and then proceed to multivariate regression.&lt;br /&gt;
&lt;br /&gt;
Let’s use the Canadian cross-section wage data (&amp;lt;b&amp;gt;cps71&amp;lt;/b&amp;gt;) consisting of a random sample taken from the 1971 Canadian Census for male individuals having common education (High-School). N=205 observations, 2 variables, the logarithm of the individual’s wage (logwage) and their age (age). The classical wage equation model includes a quadratic term of age.&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;np&amp;quot;)&lt;br /&gt;
 library(&amp;quot;np&amp;quot;)&lt;br /&gt;
 data(&amp;quot;cps71&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (1) Linear Model -&amp;gt; R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;  = 0.2308&lt;br /&gt;
 model.lin &amp;lt;- lm( logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
 summary(model.lin)&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = logwage ~ age + I(age^2), data = cps71)&lt;br /&gt;
&lt;br /&gt;
 Residuals:&lt;br /&gt;
 Min      1Q  Median      3Q     Max &lt;br /&gt;
 -2.4041 -0.1711  0.0884  0.3182  1.3940 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Coefficients&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||Estimate||Std. Error||t Value||$Pr(&amp;gt;|t|)$&lt;br /&gt;
|-   &lt;br /&gt;
|(Intercept)||10.0419773||0.4559986||22.022||&amp;lt; 2e-16 ***&lt;br /&gt;
|-&lt;br /&gt;
|Age||0.1731310||0.0238317|| 7.265||7.96e-12 ***&lt;br /&gt;
|-&lt;br /&gt;
|I(age^2)||-0.0019771||0.0002898||-6.822||1.02e-10 ***&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1&lt;br /&gt;
&lt;br /&gt;
 Residual standard error: 0.5608 on 202 degrees of freedom&lt;br /&gt;
 Multiple R-squared:  0.2308,	Adjusted R-squared:  0.2232 &lt;br /&gt;
 F-statistic:  30.3 on 2 and 202 DF,  p-value: 3.103e-12&lt;br /&gt;
&lt;br /&gt;
 # (2) Next, we consider the local linear nonparametric method employing cross-validated &lt;br /&gt;
 # bandwidth selection and estimation in one step. Start with computing the least-squares&lt;br /&gt;
 #  cross-validated bandwidths for the local constant estimator (default).&lt;br /&gt;
 # Note that &amp;lt;b&amp;gt;R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 0.3108675&amp;lt;/b&amp;gt;&lt;br /&gt;
 bandwidth &amp;lt;- npregbw(formula= logwage ~ age, data = cps71)&lt;br /&gt;
 model.np &amp;lt;- npreg(bandwidth,  regtype = &amp;quot;ll&amp;quot;,  bwmethod = &amp;quot;cv.aic&amp;quot;, gradients = TRUE, data = cps71)&lt;br /&gt;
 summary(model.np)&lt;br /&gt;
&lt;br /&gt;
 Regression Data: 205 training points, in 1 variable(s) age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
 Kernel Regression Estimator: Local-Constant&lt;br /&gt;
 Bandwidth Type: Fixed&lt;br /&gt;
 Residual standard error: 0.5307943&lt;br /&gt;
 R-squared: &amp;lt;b&amp;gt;&amp;lt;mark&amp;gt;0.3108675&amp;lt;/mark&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 Continuous Kernel Type: Second-Order Gaussian&lt;br /&gt;
 No. Continuous Explanatory Vars.: 1&lt;br /&gt;
&lt;br /&gt;
 # NP model significance may be tested by&lt;br /&gt;
 npsigtest(model.np)&lt;br /&gt;
&lt;br /&gt;
 Kernel Regression Significance Test&lt;br /&gt;
 Type I Test with IID Bootstrap (399 replications, Pivot=TRUE, joint=FALSE)&lt;br /&gt;
 Explanatory variables tested for significance: age (1)&lt;br /&gt;
&lt;br /&gt;
               age&lt;br /&gt;
 Bandwidth(s): 1.892157&lt;br /&gt;
&lt;br /&gt;
 Individual Significance Tests&lt;br /&gt;
 P Value: &lt;br /&gt;
 age &amp;lt; 2.22e-16 ***&lt;br /&gt;
&lt;br /&gt;
 # So, as was the case for the linear parametric model, Age is significant in the local linear NP-model&lt;br /&gt;
&lt;br /&gt;
 # (3) Graphical comparison of parametric and nonparametric models. &lt;br /&gt;
 plot(cps71$\$$age, cps71$\$$logwage, xlab = &amp;quot;age&amp;quot;, ylab = &amp;quot;log(wage)&amp;quot;, cex=.1)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.lin), lty = 2, col = &amp;quot; red&amp;quot;)&lt;br /&gt;
 lines(cps71$\$$age, fitted(model.np), lty = 1, col = &amp;quot;blue&amp;quot;)&lt;br /&gt;
 legend(&amp;quot;topright&amp;quot;, c(&amp;quot;Data&amp;quot;, &amp;quot;Linear&amp;quot;, &amp;quot;Non-linear&amp;quot;), col=c(&amp;quot;Black&amp;quot;, &amp;quot;Red&amp;quot;, &amp;quot;Blue&amp;quot;), pch = c(1, 1, 1), bty='n', cex=.75)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods14.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # some additional plots resenting the parametric (quadratic, dashed line) and the nonparametric estimates &lt;br /&gt;
 # (solid line) of the regression function for the cps71 data. &lt;br /&gt;
 plot(model.np, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE)&lt;br /&gt;
 lines(cps71$\$$age, coef(model.lin)[2]+2*cps71$\$$age*coef(model.lin)[3], lty = 2, col = &amp;quot;red&amp;quot;)&lt;br /&gt;
 plot(model.np, gradients = TRUE, plot.errors.method = &amp;quot;asymptotic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 # (4) using the Lin and NL models to generate predictions based on the obtained appropriate &lt;br /&gt;
 # bandwidths and estimated a nonparametric model. We need to create a set of explanatory&lt;br /&gt;
 # variables for which to generate predictions. These can be part of the original dataset or be&lt;br /&gt;
 # outside its scope. Typically, we don’t have the outcome for the evaluation data and need only &lt;br /&gt;
 # provide the explanatory variables for which predicted values are generated by the models.&lt;br /&gt;
 # Occasionally, splitting the dataset into two independent samples (training/testing), allows estimation&lt;br /&gt;
 # of a model on one sample, and evaluation of its performance on another.&lt;br /&gt;
&lt;br /&gt;
 cps.eval.data &amp;lt;- data.frame(age = seq(10,70, by=10)) # simulate some explanatory X values (ages)&lt;br /&gt;
 pred.lin &amp;lt;- predict(model.lin, newdata = cps.eval.data)		# Linear Prediction of log(Wage)&lt;br /&gt;
 pred.np &amp;lt;- predict(model.np, newdata = cps.eval.data)		# non-Linear Prediction of log(Wage)&lt;br /&gt;
 plot(pred.lin, pred.np)&lt;br /&gt;
 abline(lm(pred.np ~ pred.lin))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods15.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
==Predictive risk models ==&lt;br /&gt;
&lt;br /&gt;
Predictive risk models represent a class of methods for identifying potential for HTE when the individual patient risk for disease-related events at baseline depends on observed factors. For instance, common measures are disease staging criteria, such as those used in COPD or heart failure, Framingham risk scores for cardiovascular event risk, or genetic variations, e.g., HER2 for breast cancer. Initial predictive risk modeling, aka risk function estimation, is often performed without accounting for treatment effects. Least squares or Cox proportional hazards regression methods are appropriate in many cases and provide relatively more interpretable risk functions, but rely on linearity assumptions and may not provide optimal predictive metrics. Partial least squares is an extension of least squares methods that can reduce the dimensionality of the predictor space by interposing latent variables, predicted by linear combinations of observable characteristics, as the intermediate predictors of one or more outcomes. Recursive partitioning, such as random forests, support vector machines, and neural networks represent latter methods with better predictive power than linear methods. Risk function estimation can range from highly exploratory analyses to near meta-analytic model validation, and may be useful at any stage of product development.&lt;br /&gt;
&lt;br /&gt;
HIV Example: The &amp;lt;b&amp;gt;“hmohiv”&amp;lt;/b&amp;gt; dataset   represents a study of HIV positive patients examining whether there was a difference in survival times of HIV positive patients between a cohort using intravenous drugs (drug=1) and a cohort not using the IV drug (drug=0). The &amp;lt;b&amp;gt;hmohiv&amp;lt;/b&amp;gt; data includes the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID||Time||Age||Drug||Censor||Entdate||Enddate&lt;br /&gt;
|-   &lt;br /&gt;
|1||5||46||0||1||5/15/1990||10/14/1990&lt;br /&gt;
|-&lt;br /&gt;
|2||6||35||1||0||9/19/1989||3/20/1990&lt;br /&gt;
|-&lt;br /&gt;
|3||8||30||1||1||4/21/1991||12/20/1991&lt;br /&gt;
|-&lt;br /&gt;
|4||3||30||1||1||1/3/1991||4/4/1991&lt;br /&gt;
|-&lt;br /&gt;
|5||22||36||0||1||9/18/1989||7/19/1991&lt;br /&gt;
|-&lt;br /&gt;
|6||1||32||1||0||3/18/1991||4/17/1991&lt;br /&gt;
|-&lt;br /&gt;
|...||...||...||...||...||...||...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #cleaning up environment&lt;br /&gt;
 rm(list=ls())&lt;br /&gt;
&lt;br /&gt;
 # load survival library&lt;br /&gt;
 library(survival)&lt;br /&gt;
&lt;br /&gt;
 # load hmohiv data&lt;br /&gt;
 hmohiv&amp;lt;-read.table(&amp;quot;http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv&amp;quot;, sep=&amp;quot;,&amp;quot;, header = TRUE)&lt;br /&gt;
 attach(hmohiv)&lt;br /&gt;
&lt;br /&gt;
 # Fit Cox proportional hazards regression model&lt;br /&gt;
 cox.model &amp;lt;- coxph( Surv(time, censor) ~ drug, method=&amp;quot;breslow&amp;quot;)&lt;br /&gt;
 fit.1 &amp;lt;- survfit(cox.model, newdata=drug.new)&lt;br /&gt;
&lt;br /&gt;
 # construct a frame of the 2 cohorts IV_drug and no-IV-drug&lt;br /&gt;
 drug.new&amp;lt;-data.frame(drug=c(0,1))&lt;br /&gt;
&lt;br /&gt;
 # plot results&lt;br /&gt;
 plot(fit.1, xlab=&amp;quot;Survival Time (Months)&amp;quot;, ylab=&amp;quot;Survival Probability&amp;quot;)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,1], pch=1)&lt;br /&gt;
 points(fit.1$\$$time, fit.1$\$$surv[,2], pch=2)&lt;br /&gt;
 legend(40, .8, c(&amp;quot;Drug Absent&amp;quot;, &amp;quot;Drug Present&amp;quot;), pch=c(1,2))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods16.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # to inslect the resulting Cox Proportional Hazard Model&lt;br /&gt;
 cox.model &lt;br /&gt;
 Call:&lt;br /&gt;
 coxph(formula = Surv(time, censor) ~ drug, method = &amp;quot;breslow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      	    coef 	exp(coef) 	se(coef)   	z      	        p&lt;br /&gt;
 &amp;lt;b&amp;gt;drug&amp;lt;/b&amp;gt; 	0.779          2.18    		0.242 		3.22 	       &amp;lt;b&amp;gt;0.0013&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Likelihood ratio test=10.2  on 1 df, p=0.00141  n= 100, number of events= 80 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[[SMHS_MethodsHeterogeneity_CER|Next see: Comparative Effectiveness Research (CER)]]==&lt;br /&gt;
&lt;br /&gt;
*[[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_MetaAnalysis}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16209</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16209"/>
		<updated>2016-05-23T18:42:37Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Latent growth and growth mixture modeling (LGM/GMM) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;,&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the '''hmle''' call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 '''Convergence criteria satisfied''' &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme&amp;lt;mark&amp;gt;.2&amp;lt;/mark&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
&lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
&lt;br /&gt;
 Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
&lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
&lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$\$$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
*&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/lcmm/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt; http://arxiv.org/pdf/1503.00890v1.pdf&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16208</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16208"/>
		<updated>2016-05-23T18:40:39Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Latent growth and growth mixture modeling (LGM/GMM) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;,&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the '''hmle''' call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 '''Convergence criteria satisfied''' &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme&amp;lt;mark&amp;gt;.2&amp;lt;/mark&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
&lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
&lt;br /&gt;
 Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
&lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
&lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
*&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/lcmm/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt; http://arxiv.org/pdf/1503.00890v1.pdf&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16207</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16207"/>
		<updated>2016-05-23T18:34:56Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Latent growth and growth mixture modeling (LGM/GMM) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;,&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the '''hmle''' call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 '''Convergence criteria satisfied''' &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme.2)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
 &lt;br /&gt;
Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
 &lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
 &lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
*&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/lcmm/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt; http://arxiv.org/pdf/1503.00890v1.pdf&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16206</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16206"/>
		<updated>2016-05-23T18:33:22Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Footnotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;,&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the hmle call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 Convergence criteria satisfied &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme.2)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
 &lt;br /&gt;
Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
 &lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
 &lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
*&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; http://cran.r-project.org/web/packages/lcmm/ &lt;br /&gt;
*&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt; http://arxiv.org/pdf/1503.00890v1.pdf&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16205</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16205"/>
		<updated>2016-05-23T18:32:31Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Latent growth and growth mixture modeling (LGM/GMM) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;,&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the hmle call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 Convergence criteria satisfied &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme.2)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
 &lt;br /&gt;
Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
 &lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
 &lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;  http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;   http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;   http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;   http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;  http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16204</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16204"/>
		<updated>2016-05-23T18:31:20Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Random Forests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
====(3) Random Forests ====&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the hmle call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 Convergence criteria satisfied &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme.2)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
 &lt;br /&gt;
Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
 &lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
 &lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;  http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;   http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;   http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;   http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;  http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16203</id>
		<title>SMHS MethodsHeterogeneity HTE</title>
		<link rel="alternate" type="text/html" href="https://wiki.socr.umich.edu/index.php?title=SMHS_MethodsHeterogeneity_HTE&amp;diff=16203"/>
		<updated>2016-05-23T18:31:00Z</updated>

		<summary type="html">&lt;p&gt;Pineaumi: /* Example Fifth Dutch growth study */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[[SMHS_MethodsHeterogeneity| Methods for Studying Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research]] - Methods and Approaches for HTE Analytics ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Recursive partitioning is a data mining technique for exploring structure and patterns in complex data. It facilitates the visualization of decision rules for predicting categorical (classification tree) or continuous (regression tree) outcome variables. The R &amp;lt;b&amp;gt;rpart&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; provides the tools for Classification and Regression Tree (CART) modeling, conditional inference trees, and random forests. Additional resources include an Introduction to Recursive Partitioning Using the RPART Routines&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. The &amp;lt;b&amp;gt;Appendix&amp;lt;/b&amp;gt; includes description of the main CART analysis steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;b&amp;gt;install.packages(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;b&amp;gt;library(&amp;quot;rpart&amp;quot;)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CART===&lt;br /&gt;
Classification and Regression Tree (CART) is a decision-tree based technique that considers how variation observed in a given response variable (continuous or categorical) can be understood through a systematic deconstruction of the overall study population into subgroups, using explanatory variables of interest. For HTE analysis, CART is best suited for early-stage, exploratory analyses. Its relative simplicity can be powerful in identifying basic relationships between variables of interest, and thus identify potential subgroups for more advanced analyses. The key to CART is its ‘systematic’ approach to the development of the subgroups, which are constructed sequentially through repeated, binary splits of the population of interest, one explanatory variable at a time. In other words, each ‘parent’ group is divided into two ‘child’ groups, with the objective of creating increasingly homogeneous subgroups. The process is repeated and the subgroups are then further split, until no additional variables are available for further subgroup development. The resulting tree structure is oftentimes overgrown, but additional techniques are used to ‘trim’ the tree to a point at which its predictive power is balanced against issues of over-fitting. Because the CART approach does not make assumptions regarding the distribution of the dependent variable, it can be used in situations where other multivariate modeling techniques often used for exploratory predictive risk modeling would not be appropriate – namely in situations where data are not normally distributed. &lt;br /&gt;
&lt;br /&gt;
CART analyses are useful in situations where there is some evidence to suggest that HTE exists, but the subgroups defining the heterogeneous response are not well understood. CART allows for an exploration of response in a myriad of complex subpopulations, and more recently developed ensemble methods (such as Bayesian Additive Regression Trees) allow for more robust analyses through the combination of multiple CART analyses.&lt;br /&gt;
&lt;br /&gt;
====Example Fifth Dutch growth study====&lt;br /&gt;
&lt;br /&gt;
 # Let’s use the Fifth Dutch growth study (2009) &amp;lt;b&amp;gt;fdgs&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/b&amp;gt;. Is it true that “the world’s tallest nation has stopped growing taller: the height of Dutch children from 1955 to 2009”&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
 #install.packages(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 library(&amp;quot;mice&amp;quot;)&lt;br /&gt;
 ?fdgs&lt;br /&gt;
 head(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||ID ||Reg ||Age ||Sex ||HGT ||WGT ||HGT.Z ||WGT.Z&lt;br /&gt;
|-&lt;br /&gt;
|1 ||100001||West||13.09514||boy||175.5||75.0||1.751||2.410&lt;br /&gt;
|-&lt;br /&gt;
|2 ||100003||West||13.81793 ||boy||148.4||40.0||2.292||1.494&lt;br /&gt;
|-&lt;br /&gt;
|3 ||100004||West||13.97125||boy||159.9||46.5||0.743||0.783&lt;br /&gt;
|-&lt;br /&gt;
|4 ||100005||West||13.98220 ||girl||159.7||46.5 ||0.743 ||0.783&lt;br /&gt;
|-&lt;br /&gt;
|5||100006||West||13.52225||girl||160.3||47.8||0.414||0.355&lt;br /&gt;
|-&lt;br /&gt;
|6||100018||East||10.21492||boy||157.8||39.7||2.025||0.823&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 summary(fdgs)        &lt;br /&gt;
 summary(fdgs)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|ID ||Reg ||Age ||Sex ||HGT&lt;br /&gt;
|-&lt;br /&gt;
|Min.:100001||North:732||Min.:0.008214||boy:4829||Min.:46.0&lt;br /&gt;
|-&lt;br /&gt;
|1st Qu.:106353||East:2528||1st Qu.:1.618754||girl:5201||1st Qu.:83.8&lt;br /&gt;
|-&lt;br /&gt;
|Median:203855||South:2931||Median:8.084873|| ||Median:131.5&lt;br /&gt;
|-&lt;br /&gt;
|Mean:180091||West:2578||Mean:8.157936|| ||Mean:123.9&lt;br /&gt;
|-&lt;br /&gt;
|3rd Qu.210591||City:1261||3rd Qu.:13.547570|| ||3rd Qu.:162.3&lt;br /&gt;
|-&lt;br /&gt;
|Max:401955|| ||Max.:21.993155|| ||Max.:208.0&lt;br /&gt;
|-&lt;br /&gt;
| || || || ||NA's: 23&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(1) Classification Tree====&lt;br /&gt;
&lt;br /&gt;
Let's use the data frame '''fdgs''' to predict Region, from Age, Height, and Weight.&lt;br /&gt;
 # grow tree &lt;br /&gt;
 fit.1 &amp;lt;- rpart(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, data= fdgs[,-1])&lt;br /&gt;
&lt;br /&gt;
 printcp(fit.1) 	# display the results &lt;br /&gt;
 plotcp(fit.1) 	# visualize cross-validation results &lt;br /&gt;
 summary(fit.1) 	# detailed summary of splits&lt;br /&gt;
&lt;br /&gt;
 # plot tree &lt;br /&gt;
 par(oma=c(0,0,2,0))&lt;br /&gt;
 plot(fit.1, uniform=TRUE,  margin=0.3, main=&amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods2.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # create a better plot of the classification tree &lt;br /&gt;
 post(fit.1, title = &amp;quot;Classification Tree for Region (FDGS Data)&amp;quot;, file = &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods3.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====(2) Pruning the tree==== &lt;br /&gt;
&lt;br /&gt;
 pruned.fit.1&amp;lt;- prune(fit.1, cp=   fit.1$\$$cptable[which.min(fit.1$\$$\$$cptable[,&amp;quot;xerror&amp;quot;]),&amp;quot;CP&amp;quot;])&lt;br /&gt;
&lt;br /&gt;
 # plot the pruned tree &lt;br /&gt;
 plot(pruned.fit.1, uniform=TRUE,  main=&amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
 text(pruned.fit.1, use.n=TRUE, all=TRUE, cex=1.0)&lt;br /&gt;
 post(pruned.fit.1,  title = &amp;quot;Pruned Classification Tree for Region (FDGS Data)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Not much change, as the initial tree is not complex!&lt;br /&gt;
&lt;br /&gt;
===Random Forests ===&lt;br /&gt;
Random forests may improve predictive accuracy by generating a large number of bootstrapped trees (based on random samples of variables). It classifies cases using each tree in this new &amp;quot;forest&amp;quot;, and decides the final predicted outcome by combining the results across all of the trees (an average in regression, a majority vote in classification). See the &amp;lt;b&amp;gt;randomForest&amp;lt;/b&amp;gt; package&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
 library(randomForest)&lt;br /&gt;
 fit.2 &amp;lt;- randomForest(reg ~ age + hgt + wgt,   method=&amp;quot;class&amp;quot;, na.action = na.omit, data= fdgs[,-1])&lt;br /&gt;
 print(fit.2) 		# view results &lt;br /&gt;
 importance(fit.2) 	# importance of each predictor &lt;br /&gt;
&lt;br /&gt;
Note on missing values/incomplete data: If the data have missing values, we have 3 choices:&lt;br /&gt;
&lt;br /&gt;
1.	Use a different tool (rpart handles missing values well)&lt;br /&gt;
&lt;br /&gt;
2.	Impute the missing values&lt;br /&gt;
&lt;br /&gt;
3.	For a small number of missing cases, we can use na.action = na.omit&lt;br /&gt;
&lt;br /&gt;
===Latent growth and growth mixture modeling (LGM/GMM)===&lt;br /&gt;
&lt;br /&gt;
LGM and GMM represent structural equation modeling techniques that capture inter-individual differences in longitudinal change corresponding to a particular treatment. For instance, patients’ different timing patterns of the treatment effects may represent the underlying sources of HTE. LGM distinguish if (yes/no) and how (fast/slow, temporary/lasting) patients respond to treatment. The heterogeneous individual growth trajectories are estimated from intra-individual changes over time by examining common population parameters, i.e., slopes, intercepts, and error variances. Suppose each individual has unique initial status (intercept) and response rate (slope) during a specific time interval. Then the variances of the individuals’ baseline measures (intercepts) and changes (slopes) in health outcomes will represent the degree of HTE. The LGM-identified HTE of individual growth curves can be attributed to observed predictors, including both fixed and time varying covariates.&lt;br /&gt;
&lt;br /&gt;
LGM assumes that all individuals are from the same population (too restrictive in some cases). If the HTE is due to observed demographic variables, such as age, gender, and marital status, one may utilize multiple-group LGM. Despite its successful applications for modeling longitudinal change, there may be multiple subpopulations with unobserved heterogeneities. Growth mixture modeling (GMM) extends LGM to allow the identification and prediction of unobserved subpopulations in longitudinal data analysis. Each unobserved subpopulation may constitute its own latent class and behave differently than individuals in other latent classes. Within each latent class, there are also different trajectories across individuals; however, different latent classes don’t share common population parameters. Suppose we are interested in studying retirees’ psychological well-being change trajectory when multiple unknown subpopulations exist. We can add another layer (a latent class variable) on the LGM framework so that the unobserved latent classes can be inferred from the data. The covariates in GMM are designed to affect growth factors distinctly across different latent classes. Therefore, there are two types of HTE: 1) the latent class variable in GMM divides individuals into groups with different growth curves; and 2) coefficient estimates vary across latent classes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Latent variables&amp;lt;/b&amp;gt; are not directly observed – they are inferred (via a model) from other actually observed and directly measured variables. Models that explain observed variables in terms of latent variables are called latent variable models. Then the latent (unobserved) variable is discrete, it’s referred to as &amp;lt;b&amp;gt;latent class variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breast Cancer Example: Recall the LMER package, earlier review discussions, where Linear Mixed Model (LMM) are used for longitudinal data to examine change over time of outcomes according relative to predictive covariates. LMM assumptions include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt; continuous longitudinal outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt; Gaussian random-effects and errors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt; linearity of the relationships with the outcome&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iv)&amp;lt;/b&amp;gt; homogeneous population&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(v)&amp;lt;/b&amp;gt; missing at random data&lt;br /&gt;
&lt;br /&gt;
The objectives of LGM/GMM models (see &amp;lt;b&amp;gt;Latent Class Mixed Models, lcmm&amp;lt;/b&amp;gt; R package) are to extend the linear mixed model estimation to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(i)&amp;lt;/b&amp;gt;	heterogeneous populations (relax (iv) above). Use &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; for latent class linear mixed models&amp;lt;/mark&amp;gt; (i.e. Gaussian continuous outcome)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(ii)&amp;lt;/b&amp;gt;	other types of longitudinal outcomes : ordinal, (bounded) quantitative non-Gaussian outcomes (relax (i), (ii), (iii), (iv)). Use &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; for general latent class mixed models with outcomes of different nature&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;(iii)&amp;lt;/b&amp;gt;	joint analysis of a time-to-event (relax (iv), (v)). Use &amp;lt;b&amp;gt;Jointlcmm&amp;lt;/b&amp;gt; for joint latent class models with a longitudinal outcome and a right-censored (left-truncated) time-to-event&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let’s use these data (http://www.ats.ucla.edu/stat/data/hdp.csv), representing cancer phenotypes and predictors (e.g., &amp;quot;IL6&amp;quot;, &amp;quot;CRP&amp;quot;, &amp;quot;LengthofStay&amp;quot;, &amp;quot;Experience&amp;quot;) and outcome measures (e.g., remission) collected on patients, nested within doctors (DID) and within hospitals (HID).&lt;br /&gt;
&lt;br /&gt;
We can illustrate the latent class linear mixed models implemented in &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; through a study of the quadratic trajectories of the response (remission) with TumorSize, adjusting for CO2*Pain interaction and assuming correlated random-effects for the functions of SmokingHx and Sex. To estimate the corresponding standard linear mixed model using 1 latent class where CO2 interacts with Pain:&lt;br /&gt;
&lt;br /&gt;
 # install.packages(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
 library(&amp;quot;lcmm&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 hdp &amp;lt;- read.csv(&amp;quot;http://www.ats.ucla.edu/stat/data/hdp.csv&amp;quot;)&lt;br /&gt;
 hdp &amp;lt;- within(hdp, {&lt;br /&gt;
 Married &amp;lt;- factor(Married, levels = 0:1, labels = c(&amp;quot;no&amp;quot;, &amp;quot;yes&amp;quot;))&lt;br /&gt;
 DID &amp;lt;- factor(DID)&lt;br /&gt;
 HID &amp;lt;- factor(HID)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
add a new subject ID column (last column in the data, “ID”), this is necessary for the hmle call&lt;br /&gt;
hdp$\$$ID &amp;lt;- seq.int(nrow(hdp))&lt;br /&gt;
&lt;br /&gt;
 model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 summary(model.hlme)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Heterogenous linear mixed model &lt;br /&gt;
 fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 hlme(fixed = remission ~ IL6 + CRP + LengthofStay + Experience + &lt;br /&gt;
 I(tumorsize^2) + co2 * pain + I(tumorsize^2) * pain, random = ~SmokingHx + &lt;br /&gt;
 Sex, subject = &amp;quot;ID&amp;quot;, ng = 1, data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
 Dataset: hdp &lt;br /&gt;
 Number of subjects: 8525 &lt;br /&gt;
 Number of observations: 8525 &lt;br /&gt;
 Number of latent classes: 1 &lt;br /&gt;
 Number of parameters: 21  &lt;br /&gt;
 &lt;br /&gt;
 Iteration process: 	&lt;br /&gt;
 Convergence criteria satisfied &lt;br /&gt;
 Number of iterations:  34 &lt;br /&gt;
 Convergence criteria: parameters= 1.2e-09 &lt;br /&gt;
 : likelihood= 8.3e-06 &lt;br /&gt;
 : second derivatives= 2.7e-05 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
 maximum log-likelihood: -5223.9  &lt;br /&gt;
 AIC: 10489.79  &lt;br /&gt;
 BIC: 10637.86&lt;br /&gt;
&lt;br /&gt;
Maximum Likelihood Estimates: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Fixed effects in the Longitudinal Model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||coef||Se||Wald||p-value&lt;br /&gt;
|-&lt;br /&gt;
|Intercept||0.28636||0.24314||1.178||0.23890&lt;br /&gt;
|-&lt;br /&gt;
|IL6||-0.01134||0.00183||-6.184||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|CRP||-0.00674||0.00167||-4.043||0.00005&lt;br /&gt;
|-&lt;br /&gt;
|LengthofStay||-0.04834||0.00463||-10.436||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|Experience||0.01695||0.00119||14.263||0.00000&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2)||0.00000||0.00001||-0.076||0.93953&lt;br /&gt;
|-&lt;br /&gt;
|co2||-0.03549||0.16204||-0.219||0.82663&lt;br /&gt;
|-&lt;br /&gt;
|pain||0.03930||0.04278||0.919||0.35832&lt;br /&gt;
|-&lt;br /&gt;
|co2:pain||-0.01489||0.02871||-0.519||0.60395&lt;br /&gt;
|-&lt;br /&gt;
|I(tumorsize^2):pain||0.00000||0.00000||0.553||0.58045&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;Variance-covariance matrix of the random-effects&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; &amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ||intercept||SmokingHxformer||SmokingHxnever||Sexmale&lt;br /&gt;
|-&lt;br /&gt;
|intercept||0.19310943|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxformer||-0.10617988||0.209155186|| ||&lt;br /&gt;
|-&lt;br /&gt;
|SmokingHxnever||-0.12388534||0.068342049||2.262655e-01|| &lt;br /&gt;
|-&lt;br /&gt;
|Sexmale||-0.08130975||-0.007353491||-1.873934e-05||0.1730187&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
                          &lt;br /&gt;
Residual standard error:&lt;br /&gt;
&lt;br /&gt;
coef: 0.1299767&lt;br /&gt;
&lt;br /&gt;
se: 1.187426&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Results interpretation:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(1)	The first part of the summary provides information about the dataset, the number of subjects, observations, observations deleted (since by default, missing observations are deleted), number of latent classes and number of parameters. &lt;br /&gt;
&lt;br /&gt;
(2)	Next, details about the algorithm convergence is provided along with the number of iterations, the convergence criteria, and the information indicating if the model converged correctly: &amp;quot;convergence criteria satisfied&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
(3)	The maximum log-likelihood, Akaike criterion (AIC) and Bayesian Information criterion (BIC) are reported. &lt;br /&gt;
&lt;br /&gt;
(4)	Estimates of parameters, the estimated standard error, the Wald Test statistics (with Normal approximation) and the corresponding p-values are reported below. &lt;br /&gt;
&lt;br /&gt;
(5)	For the random-effect distribution, the estimated matrix of covariance of the random-effects is displayed.&lt;br /&gt;
&lt;br /&gt;
(6)	The standard error of the residuals is given along with its estimated standard error.&lt;br /&gt;
&lt;br /&gt;
(7)	The effect of &amp;lt;b&amp;gt;TumorSize&amp;lt;/b&amp;gt; seems not associated with change over Pain of Remission. This may be formally assessed using a multivariate Wald test:&lt;br /&gt;
&lt;br /&gt;
 WaldMult(model.hlme, pos=c(6,8)) &lt;br /&gt;
 # pos - a vector containing the indices in model.hlme of the parameters to test&lt;br /&gt;
 Wald Test p_value&lt;br /&gt;
 I(tumorsize^2) = pain = 0   0.85562 0.65193&lt;br /&gt;
&lt;br /&gt;
We may consider the model with an adjustment for CRP only on the intercept. Below we estimate the corresponding &amp;lt;mark&amp;gt;&amp;lt;b&amp;gt;models for a varying number of latent classes&amp;lt;/b&amp;gt;&amp;lt;/mark&amp;gt; (from 1 to 3) using the default initial values:&lt;br /&gt;
&lt;br /&gt;
 # Initial Model: model.hlme &amp;lt;- hlme(remission ~ IL6 + CRP + LengthofStay + Experience + I(tumorsize^2) + co2*pain + I(tumorsize^2)*pain, random=~ SmokingHx + Sex, subject='ID', data=hdp, ng=1)&lt;br /&gt;
&lt;br /&gt;
 model.hlme.1 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay, subject='ID', data=hdp, ng=1)&lt;br /&gt;
 model.hlme.2 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=2)&lt;br /&gt;
 model.hlme.3 &amp;lt;- hlme(tumorsize ~ IL6 + CRP + LengthofStay + SmokingHx, mixture=~ SmokingHx, subject='ID', data=hdp, ng=3)&lt;br /&gt;
&lt;br /&gt;
The estimation process for a varying number of latent classes can be summarized with &amp;lt;b&amp;gt;summarytable,&amp;lt;/b&amp;gt; which gives the &amp;lt;b&amp;gt;log-likelihood&amp;lt;/b&amp;gt;, the number of parameters, the Bayesian Information Criterion, and the posterior proportion of each class:&lt;br /&gt;
&lt;br /&gt;
 summarytable(model.hlme.1, model.hlme.2, model.hlme.3)&lt;br /&gt;
             G    loglik npm      BIC    %class1    %class2  %class3&lt;br /&gt;
 model.hlme.1 1 -33301.82   5 66648.89 100.000000                    &lt;br /&gt;
 model.hlme.2 2 -31592.79  11 63285.15  99.214076  0.7859238         &lt;br /&gt;
 model.hlme.3 3 -31589.55  15 63314.86   6.357771 82.2991202 11.34311&lt;br /&gt;
&lt;br /&gt;
The program took 404.65 seconds&lt;br /&gt;
&lt;br /&gt;
In this example, the optimal number of latent classes according to the BIC is two (the smallest BIC).  The posterior classification is described with:&lt;br /&gt;
&lt;br /&gt;
 postprob(model.hlme.2)&lt;br /&gt;
&lt;br /&gt;
 Posterior classification: &lt;br /&gt;
   class1 class2&lt;br /&gt;
 N 8458.00  67.00&lt;br /&gt;
 %   99.21   0.79&lt;br /&gt;
 &lt;br /&gt;
 Posterior classification table: &lt;br /&gt;
     --&amp;gt; mean of posterior probabilities in each class &lt;br /&gt;
        prob1  prob2&lt;br /&gt;
 class1 0.8555 0.1445&lt;br /&gt;
 class2 0.4362 0.5638&lt;br /&gt;
 &lt;br /&gt;
 Posterior probabilities above a threshold (%): &lt;br /&gt;
         class1 class2&lt;br /&gt;
 prob&amp;gt;0.7  92.48   2.99&lt;br /&gt;
 prob&amp;gt;0.8  77.38   0.00&lt;br /&gt;
 prob&amp;gt;0.9  38.53   0.00&lt;br /&gt;
&lt;br /&gt;
In this example, the first class includes a posteriori 8458 subjects (99%) while class 2 includes 67 (0.79%) subjects. Subjects were classified in class 1 with a mean posterior probability of 0.8555 %. &lt;br /&gt;
&lt;br /&gt;
In class 1, 92.48% were classified with a posterior probability above 0.7 while 2.99% of the subjects were classified in class 2 with a posterior probability above 0.7. Goodness-of-fit of the model can be assessed by displaying the residuals as in figure and the mean predictions of the model as in figure, according to the time variable given in &amp;lt;b&amp;gt;var.time&amp;lt;/b&amp;gt;:  &lt;br /&gt;
&lt;br /&gt;
 plot(model.hlme.2)&lt;br /&gt;
 # Figure (left panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2) &lt;br /&gt;
 # Figure (right panel)&lt;br /&gt;
 plot(model.hlme.2, which=&amp;quot;fit&amp;quot;, var.time=&amp;quot;Age&amp;quot;, bty=&amp;quot;l&amp;quot;, ylab=&amp;quot; Remission &amp;quot;, xlab=&amp;quot;Age&amp;quot;, lwd=2, marg=FALSE)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods4.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods5.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods6.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latent process mixed models implemented in &amp;lt;b&amp;gt;lcmm&amp;lt;/b&amp;gt; are illustrated through the study of the linear trajectory of &amp;lt;b&amp;gt;ntumors&amp;lt;/b&amp;gt; with Age adjusted for Sex and assuming correlated random-effects for the intercept and Age. Lines estimate the corresponding latent process mixed model with different link functions:&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', data=hdp)&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta')&lt;br /&gt;
 model.hlme.spl &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='splines')&lt;br /&gt;
 model.hlme.spl5q &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='5-quant-splines')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;link function&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;: An optional family of link functions. By default, &lt;br /&gt;
&lt;br /&gt;
*&amp;quot;linear&amp;quot; option specifies a linear link function leading to a standard linear mixed model (homogeneous or heterogeneous as estimated in hlme).&lt;br /&gt;
*&amp;quot;beta&amp;quot; for estimating a link function from the family of Beta cumulative distribution functions, &amp;quot;thresholds&amp;quot; for using a threshold model to describe the correspondence between each level of an ordinal outcome and the underlying latent process, and&lt;br /&gt;
*&amp;quot;Splines&amp;quot; for approximating the link function by I-splines. For this latter case, the number of nodes and the nodes location should be also specified. The number of nodes is first entered followed by,&lt;br /&gt;
* -, then the location is specified with &amp;quot;equi&amp;quot;, &amp;quot;quant&amp;quot; or &amp;quot;manual&amp;quot; for respectively equidistant nodes, nodes at quantiles of the marker distribution or interior nodes entered manually in argument&lt;br /&gt;
*intnodes. It is followed by - and finally &amp;quot;splines&amp;quot; is indicated. For example, &amp;quot;7-equi-splines&amp;quot; means I-splines with 7 equidistant nodes, &amp;quot;6-quant-splines&amp;quot; means I-splines with 6 nodes located at the quantiles of the marker distribution and &amp;quot;9-manual-splines&amp;quot; means I-splines with 9 nodes, the vector of 7 interior nodes being entered in the argument intnodes.&lt;br /&gt;
&lt;br /&gt;
 summary (model.hlme.lin)&lt;br /&gt;
&lt;br /&gt;
 General latent class mixed model fitted by maximum likelihood method &lt;br /&gt;
 &lt;br /&gt;
 lcmm(fixed = ntumors ~ Age * Sex, random = ~Age, subject = &amp;quot;ID&amp;quot;,data = hdp)&lt;br /&gt;
 &lt;br /&gt;
 Statistical Model: &lt;br /&gt;
     Dataset: hdp &lt;br /&gt;
     Number of subjects: 8525 &lt;br /&gt;
     Number of observations: 8525 &lt;br /&gt;
     Number of latent classes: 1 &lt;br /&gt;
     Number of parameters: 8  &lt;br /&gt;
     Link function: linear  &lt;br /&gt;
 &lt;br /&gt;
Iteration process: &lt;br /&gt;
     Maximum number of iteration reached without convergence &lt;br /&gt;
     Number of iterations:  100 &lt;br /&gt;
     Convergence criteria: parameters= 5.4e-10 &lt;br /&gt;
                         : likelihood= 5.5e-10 &lt;br /&gt;
                         : second derivatives= 1 &lt;br /&gt;
 &lt;br /&gt;
 Goodness-of-fit statistics: &lt;br /&gt;
     maximum log-likelihood: -19915.24  &lt;br /&gt;
     AIC: 39846.49  &lt;br /&gt;
     BIC: 39902.89  &lt;br /&gt;
 &lt;br /&gt;
     Discrete posterior log-likelihood: 0  &lt;br /&gt;
     Discrete AIC: 16  &lt;br /&gt;
 &lt;br /&gt;
     Mean discrete AIC per subject: 9e-04  &lt;br /&gt;
     Mean UACV per subject: 0  &lt;br /&gt;
     Mean discrete LL per subject: 0  &lt;br /&gt;
 &lt;br /&gt;
 Maximum Likelihood Estimates: &lt;br /&gt;
 &lt;br /&gt;
 Fixed effects in the longitudinal model:&lt;br /&gt;
&lt;br /&gt;
                              coef Se Wald p-value&lt;br /&gt;
 intercept (not estimated)  0.00000                &lt;br /&gt;
 Age                        0.09491                &lt;br /&gt;
 Sexmale                   -0.66303                &lt;br /&gt;
 Age:Sexmale                0.01132                &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Variance-covariance matrix of the random-effects:&lt;br /&gt;
           intercept         Age&lt;br /&gt;
 intercept 20.5013715            &lt;br /&gt;
 Age       -0.2889814 0.007696382&lt;br /&gt;
&lt;br /&gt;
 Residual standard error (not estimated) = 1&lt;br /&gt;
&lt;br /&gt;
 Parameters of the link function:&lt;br /&gt;
&lt;br /&gt;
                         coef Se Wald p-value&lt;br /&gt;
 Linear 1 (intercept) -0.36768                &lt;br /&gt;
 Linear 2 (std err)    0.71432           &lt;br /&gt;
&lt;br /&gt;
Objects &amp;lt;b&amp;gt;mlin, mbeta, mspl and mspl3eq&amp;lt;/b&amp;gt; are latent process mixed models that assume the exact same trajectory for the underlying latent process but respectively a linear, BetaCDF, I-splines with 5 equidistant knots (default with link=’splines’) and I-splines with 5 knots at percentiles. &amp;lt;b&amp;gt;mlin&amp;lt;/b&amp;gt; reduces to a standard linear mixed model (link=’linear’ by default). The only difference with a &amp;lt;b&amp;gt;hlme&amp;lt;/b&amp;gt; object is the parameterization for the intercept and the residual standard error that are considered as rescaling parameters.&lt;br /&gt;
&lt;br /&gt;
 col &amp;lt;- rainbow(4)&lt;br /&gt;
 plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(model.hlme.beta, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[2], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[3], lwd=2)&lt;br /&gt;
 plot(model.hlme.spl5q, which=&amp;quot;linkfunction&amp;quot;, add=T, col=col[4], lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;topleft&amp;quot;,legend=c(&amp;quot;linear&amp;quot;, &amp;quot;beta&amp;quot;,&amp;quot;splines (5equidistant)&amp;quot;, &amp;quot;splines (5 at quantiles)&amp;quot;), lty=1,col=col,bty=&amp;quot;n&amp;quot;,lwd=2)&lt;br /&gt;
&lt;br /&gt;
 # to obtain confidence bands use function predictlink &lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Error in predictlink.lcmm(model.hlme.spl, ndraws = 2000):&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;No confidence intervals can be produced since the program did not converge properly&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;model.hlme.lin$\$$conv &amp;lt;mark&amp;gt;# double-check the convergence of the algorithm[1] 2&amp;lt;/mark&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# status of convergence:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =1 if the convergence criteria were satisfied,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =2 if the maximum number of iterations was reached,&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;# =4 or 5 if a problem occured during optimisation&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 model.hlme.lin &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age ,subject='ID', epsY = 0.5, convB = 1e-01, convL = 1e-01, &amp;lt;mark&amp;gt;convG = 1e-01&amp;lt;/mark&amp;gt;, maxiter=200, data=hdp); model.hlme.lin$conv&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;mark&amp;gt;# Now that we have convergence, we can obtain CI’s!!!&amp;lt;/mark&amp;gt;&lt;br /&gt;
 link.lin &amp;lt;- predictlink(model.hlme.lin, ndraws=2000)&lt;br /&gt;
&lt;br /&gt;
 # plot(model.hlme.lin, which=&amp;quot;linkfunction&amp;quot;, bty='l', ylab=&amp;quot;Number-of-Tumors&amp;quot;, col=col[1], lwd=2, xlab=&amp;quot;underlying latent process&amp;quot;)&lt;br /&gt;
 plot(link.lin, add=TRUE, col=col[1], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for linear fit&amp;quot;), lty=c(2,NA), col=c(col[1],NA), bty=&amp;quot;n&amp;quot;, lwd=2)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Image:SMHS_Methods7.png|500px]] &amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;mark&amp;gt;Repeat using the other link functions … model.hlme.beta, model.hlme.spl, …&amp;lt;/mark&amp;gt;&lt;br /&gt;
 model.hlme.beta &amp;lt;- lcmm(ntumors ~ Age*Sex, random=~ Age, subject='ID', data=hdp, link='beta', &lt;br /&gt;
 &amp;lt;mark&amp;gt;convB = 1e-01&amp;lt;/mark&amp;gt;, convL = 1e-01, convG = 1e-01, maxiter=200); model.hlme.beta$\$$conv&lt;br /&gt;
 link.beta &amp;lt;- predictlink(model.hlme.beta, ndraws=2000)&lt;br /&gt;
 plot(link.beta, add=TRUE, col=col[2], lty=2, lwd=2)&lt;br /&gt;
 legend(x=&amp;quot;left&amp;quot;, legend=c(&amp;quot;95% confidence bands&amp;quot;, &amp;quot;for BETA fit&amp;quot;), lty=c(3,NA), col=c(col[2],NA), bty=&amp;quot;n&amp;quot;, lwd=1)&lt;br /&gt;
&lt;br /&gt;
===Footnotes===&lt;br /&gt;
*&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;  http://cran.r-project.org/web/packages/rpart/index.html &lt;br /&gt;
*&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;   http://www.mayo.edu/hsr/techrpt/61.pdf &lt;br /&gt;
*&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;   http://dx.doi.org/10.1371/journal.pone.0027608  &lt;br /&gt;
*&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt;   http://www.nature.com/pr/journal/v73/n3/abs/pr2012189a.html&lt;br /&gt;
*&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;  http://stat-www.berkeley.edu/users/breiman/RandomForests/&lt;br /&gt;
&lt;br /&gt;
===[[SMHS_MethodsHeterogeneity_MetaAnalysis|Next see: Meta-Analysis]]===&lt;br /&gt;
* [[SMHS_MethodsHeterogeneity|Back to the Heterogeneity of Treatment Effects, Case-Studies of Comparative Effectiveness Research section]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* SOCR Home page: http://www.socr.umich.edu&lt;br /&gt;
&lt;br /&gt;
{{translate|pageName=http://wiki.socr.umich.edu/index.php/SMHS_MethodsHeterogeneity_HTE}}&lt;/div&gt;</summary>
		<author><name>Pineaumi</name></author>
		
	</entry>
</feed>