comparegroups updated: version 2 · 2013-11-19 · comparegroups updated: version 2.0 isaac...

36
compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H´ ector Sanz & Judith Pe˜ nafiel & Gavin Lucas & David Gim´ enez [email protected], [email protected] & [email protected] & [email protected] & [email protected] RICAD Research on Inflammatory and Cardiovascular Disorders Program IMIM-Parc de Salut Mar, Barcelona userR! Albacete, July 10-12, 2013 Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 1 / 36

Upload: others

Post on 25-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

compareGroups updated: version 2.0

Isaac Subirana& Joan Vila & Hector Sanz & Judith Penafiel & Gavin Lucas &

David [email protected], [email protected] & [email protected] & [email protected] &

[email protected]

RICAD Research on Inflammatory and Cardiovascular Disorders ProgramIMIM-Parc de Salut Mar, Barcelona

userR! Albacete, July 10-12, 2013

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 1 / 36

Page 2: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Introduction Motivation

Estruch R, Ros E, Salas-Salvado J, Covas MI, Corella D, Aros F, Gomez-Gracia E, Ruiz-Gutierrez V, Fiol M, Lapetra J, Lamuela-Raventos RM, Serra-Majem L, Pinto X, Basora J, MunozMA, Sorlı JV, Martınez JA, Martınez-Gonzalez MA; PREDIMED Study Investigators (2013). Primary prevention of cardiovascular disease with a Mediterranean diet. New England Journalof Medicine 368(14): 1279-1290.

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 2 / 36

Page 3: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Introduction Package overview

compareGroups package is meant to facilitate the user tocreate bivariate tables in an easy and rapid way.

It has a lot of parameters to change different options:decimals, reference category, report means or medians, etc.

Its code is structured in classes and methods in order to makethe syntax code easier (formula, update, subset,...).

It is simple and short to change deafault options.

A GUI has been implemented for non familiarized R users.

... WUI is under development.

compareGroups package (version 1.4) is available on CRAN.

The present version, compareGroups 2.0 will be submitted toCRAN soon.

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 3 / 36

Page 4: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Introduction Other existing R packages

Already existent many functions to display descriptives:

summaryBy [doBy],

stat.desc [pastecs],

ctab [catspec],

stat.table [Epi],

tableNominal, tableDate, tableContinuous

[reporttools],

summary.formula [Hmisc],

. . .

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 4 / 36

Page 5: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Introduction Other existing R packages

But . . .

Some of them too much specific: only categorical or onlycontinuous

Don’t mix categorical, normal (mean-SD), non-normal(quantiles)

Not very intuitive to customize tables

No GUI’s,

Difficult to add HR/OR, to deal with time-to-event variables,. . .,

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 5 / 36

Page 6: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Introduction Improvements in 2.0 version

Improvements in current version

Missingness test,

Analysis of genetic data (SNPs),

Export tables to PDF,

Generation of exhaustive report to PDF file,

Create plots in pdf, bmp, jpeg, png or tiff.

More formats in reporting statistics: mean ± SD, . . .,

More detailed vignette with new data set (PREDIMED),

GUI improved,

WUI interface to use it from a remote server,

web site to recieve feed back, publish package news, etc.http://www.comparegroups.eu

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 6 / 36

Page 7: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

How to use it

1 By syntax (full functionallity)

2 By GUI (tcltk)

3 By WUI (no R installation required) under development

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 7 / 36

Page 8: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Classes and methods structure

compareGroups

compareSNPs*

compareGroups

displaying modifying

print updatesummary subset ‘[’plot rbind

createTablemissingTable*

createTable

updatesubsetrbindcbindplot

export2:latex , csv, html, pdf

report

printsummary

Step 1:Computations

Step 2:Construction

Step 3:Exportation

already implemented

new

improved

functions

classes

meth

ods

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 8 / 36

Page 9: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Results On R console

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 9 / 36

Page 10: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Results LaTeX format

MALE FEMALENo event Event

HRNo event Event

HRN=2528 N=151 N=3544 N=101

Epidemiological:Age 66.0±6.49 68.3±7.02 1.06 [1.03;1.08] 67.6±5.78 71.0±5.71 1.10 [1.07;1.14]Body mass index 29.3±3.31 29.4±3.72 1.01 [0.97;1.06] 30.5±4.06 30.3±4.18 0.99 [0.94;1.04]Waist circumference 103±9.57 104±10.1 1.01 [0.99;1.02] 98.3±10.8 99.4±10.9 1.01 [1.00;1.03]Waist-to-height ratio 0.62±0.06 0.62±0.06 13.2 [0.85;205] 0.64±0.07 0.65±0.07 13.5 [0.89;204]

History:Smoking:

Never 27.0% 16.6% Ref. 87.4% 88.1% Ref.Current 24.8% 26.5% 1.63 [0.99;2.69] 5.14% 8.91% 1.94 [0.97;3.84]Former 48.2% 57.0% 1.92 [1.23;3.00] 7.51% 2.97% 0.43 [0.14;1.35]

Hypertension 77.7% 79.5% 1.20 [0.81;1.79] 86.4% 89.1% 1.31 [0.70;2.46]Type-2 diabetes 52.0% 64.2% 1.59 [1.14;2.22] 43.1% 63.4% 2.12 [1.41;3.18]Dyslipidemia 66.6% 58.9% 0.81 [0.58;1.11] 77.4% 61.4% 0.52 [0.35;0.78]Family history 17.4% 14.6% 0.89 [0.57;1.41] 26.5% 28.7% 1.18 [0.77;1.82]

Mediterranean diet:Intervention group:

Control 29.8% 38.4% Ref. 33.6% 38.6% Ref.MedDiet + Nuts 36.7% 27.2% 0.54 [0.36;0.80] 31.1% 28.7% 0.78 [0.48;1.26]MedDiet + VOO 33.5% 34.4% 0.71 [0.49;1.03] 35.3% 32.7% 0.69 [0.43;1.10]

MeDiet Adherence score 9.00 [8.00;10.0] 8.00 [7.00;10.0] 0.87 [0.81;0.94] 9.00 [7.00;10.0] 8.00 [7.00;9.00] 0.88 [0.80;0.97]

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 10 / 36

Page 11: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Results On HTML format

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 11 / 36

Page 12: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Plots univariate

Histogram

20 25 30 35 40 45 500.

000.

040.

08

mean= 30.0 SD= 3.82

20 25 30 35 40 45 50

−4

−2

02

4

Normal Q−Q Plot

Sample Quantiles

The

oret

ical

Qua

ntile

s

2025

3035

4045

50

Boxplot

20 25 30 35 40 45 50

0.0

0.5

1.0

1.5

2.0

Standard deviationfrom normality

desv

.

Normality plots of 'Body mass index'

Never Current Former

Barplot of 'Smoking'

Fre

q

010

0020

0030

00

0 1 2 3 4 5 6 7

0.0

0.2

0.4

0.6

0.8

1.0

time

surv

ival

K−M survival of 'tevent'

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 12 / 36

Page 13: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Plots bivariate

Control MedDiet + Nuts MedDiet + VOO

2025

3035

4045

50

Boxplot of 'Body mass index' by 'Intervention group'

Control MedDiet + Nuts MedDiet + VOO

Barplot of 'Smoking' by 'Intervention group'

Fre

q

050

010

0015

00

NeverCurrentFormer

0 1 2 3 4 5 6 7

0.0

0.2

0.4

0.6

0.8

1.0

time

surv

ival

K−M survival of 'tevent' by 'Smoking'

NeverCurrentFormer

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 13 / 36

Page 14: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Select variables, type, ...

> res <- compareGroups(tevent ~ .-toevent-event,+ data = predimed,+ method = c(p14 = 2),+ ref.no = 'no')> res

-------- Summary of results by groups of 'tevent'---------

var N p.value method selection1 Intervention group 6324 0.011** categorical ALL2 Sex 6324 <0.001** categorical ALL3 Age 6324 <0.001** continuous normal ALL4 Smoking 6324 <0.001** categorical ALL5 Body mass index 6324 0.455 continuous normal ALL6 Waist circumference 6324 0.003** continuous normal ALL7 Waist-to-height ratio 6324 0.079* continuous normal ALL8 Hypertension 6324 0.578 categorical ALL9 Type-2 diabetes 6324 <0.001** categorical ALL10 Dyslipidemia 6324 <0.001** categorical ALL11 Family history of premature CHD 6324 0.640 categorical ALL12 Hormone-replacement therapy 5661 0.195 categorical ALL13 MeDiet Adherence score 6324 <0.001** continuous non-normal ALL-----Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 14 / 36

Page 15: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Building the table

> restab <- createTable(res)

No event Eventp.overall

N=6072 N=252

Intervention group: 0.011Control 1945 (32.0%) 97 (38.5%)MedDiet + Nuts 2030 (33.4%) 70 (27.8%)MedDiet + VOO 2097 (34.5%) 85 (33.7%)

Sex: <0.001Male 2528 (41.6%) 151 (59.9%)Female 3544 (58.4%) 101 (40.1%)

Age 66.9 (6.14) 69.4 (6.65) <0.001Smoking: <0.001

Never 3778 (62.2%) 114 (45.2%)Current 809 (13.3%) 49 (19.4%)Former 1485 (24.5%) 89 (35.3%)

Body mass index 30.0 (3.81) 29.8 (3.92) 0.455Waist circumference 100 (10.6) 102 (10.6) 0.003Waist-to-height ratio 0.63 (0.07) 0.63 (0.07) 0.079Hypertension: 0.578

No 1047 (17.2%) 42 (16.7%)Yes 5025 (82.8%) 210 (83.3%)

Type-2 diabetes: <0.001No 3231 (53.2%) 91 (36.1%)Yes 2841 (46.8%) 161 (63.9%)

Dyslipidemia: <0.001No 1645 (27.1%) 101 (40.1%)Yes 4427 (72.9%) 151 (59.9%)

Family history of premature CHD: 0.640No 4694 (77.3%) 201 (79.8%)Yes 1378 (22.7%) 51 (20.2%)

Hormone-replacement therapy: 0.195No 5341 (98.2%) 223 (99.6%)Yes 96 (1.77%) 1 (0.45%)

MeDiet Adherence score 9.00 [7.00;10.0] 8.00 [7.00;10.0] <0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 15 / 36

Page 16: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Costumazing the table

> restab <- update(restab, hide.no="no", hide=c(sex='Female'))

No event Eventp.overall

N=6072 N=252

Intervention group: 0.011Control 1945 (32.0%) 97 (38.5%)MedDiet + Nuts 2030 (33.4%) 70 (27.8%)MedDiet + VOO 2097 (34.5%) 85 (33.7%)

Sex: Male 2528 (41.6%) 151 (59.9%) <0.001Age 66.9 (6.14) 69.4 (6.65) <0.001Smoking: <0.001

Never 3778 (62.2%) 114 (45.2%)Current 809 (13.3%) 49 (19.4%)Former 1485 (24.5%) 89 (35.3%)

Body mass index 30.0 (3.81) 29.8 (3.92) 0.455Waist circumference 100 (10.6) 102 (10.6) 0.003Waist-to-height ratio 0.63 (0.07) 0.63 (0.07) 0.079Hypertension 5025 (82.8%) 210 (83.3%) 0.578Type-2 diabetes 2841 (46.8%) 161 (63.9%) <0.001Dyslipidemia 4427 (72.9%) 151 (59.9%) <0.001Family history of premature CHD 1378 (22.7%) 51 (20.2%) 0.640Hormone-replacement therapy 96 (1.77%) 1 (0.45%) 0.195MeDiet Adherence score 9.00 [7.00;10.0] 8.00 [7.00;10.0] <0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 16 / 36

Page 17: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Costumazing the table

> restab <- update(restab, type = 1)

No event Eventp.overall

N=6072 N=252

Intervention group: 0.011Control 32.0% 38.5%MedDiet + Nuts 33.4% 27.8%MedDiet + VOO 34.5% 33.7%

Sex: Male 41.6% 59.9% <0.001Age 66.9 (6.14) 69.4 (6.65) <0.001Smoking: <0.001

Never 62.2% 45.2%Current 13.3% 19.4%Former 24.5% 35.3%

Body mass index 30.0 (3.81) 29.8 (3.92) 0.455Waist circumference 100 (10.6) 102 (10.6) 0.003Waist-to-height ratio 0.63 (0.07) 0.63 (0.07) 0.079Hypertension 82.8% 83.3% 0.578Type-2 diabetes 46.8% 63.9% <0.001Dyslipidemia 72.9% 59.9% <0.001Family history of premature CHD 22.7% 20.2% 0.640Hormone-replacement therapy 1.77% 0.45% 0.195MeDiet Adherence score 9.00 [7.00;10.0] 8.00 [7.00;10.0] <0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 17 / 36

Page 18: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Costumazing the table

> restab <- update(restab, show.ratio=TRUE, show.p.overall=FALSE)

No event EventHR p.ratio

N=6072 N=252

Intervention group:Control 32.0% 38.5% Ref. Ref.MedDiet + Nuts 33.4% 27.8% 0.66 [0.48;0.89] 0.008MedDiet + VOO 34.5% 33.7% 0.70 [0.53;0.94] 0.018

Sex: Male 41.6% 59.9% Ref. Ref.Age 66.9 (6.14) 69.4 (6.65) 1.06 [1.04;1.09] <0.001Smoking:

Never 62.2% 45.2% Ref. Ref.Current 13.3% 19.4% 1.96 [1.40;2.74] <0.001Former 24.5% 35.3% 2.02 [1.53;2.67] <0.001

Body mass index 30.0 (3.81) 29.8 (3.92) 0.99 [0.96;1.02] 0.455Waist circumference 100 (10.6) 102 (10.6) 1.02 [1.01;1.03] 0.003Waist-to-height ratio 0.63 (0.07) 0.63 (0.07) 5.27 [0.83;33.6] 0.079Hypertension 82.8% 83.3% 1.10 [0.79;1.53] 0.578Type-2 diabetes 46.8% 63.9% 1.88 [1.46;2.44] <0.001Dyslipidemia 72.9% 59.9% 0.62 [0.49;0.80] <0.001Family history of premature CHD 22.7% 20.2% 0.93 [0.68;1.26] 0.640Hormone-replacement therapy 1.77% 0.45% 0.29 [0.04;2.10] 0.223MeDiet Adherence score 9.00 [7.00;10.0] 8.00 [7.00;10.0] 0.88 [0.83;0.94] <0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 18 / 36

Page 19: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Costumazing the table

> restab <- update(restab, show.descr=FALSE)

HR p.ratio

Intervention group:Control Ref. Ref.MedDiet + Nuts 0.66 [0.48;0.89] 0.008MedDiet + VOO 0.70 [0.53;0.94] 0.018

Sex: Male Ref. Ref.Age 1.06 [1.04;1.09] <0.001Smoking:

Never Ref. Ref.Current 1.96 [1.40;2.74] <0.001Former 2.02 [1.53;2.67] <0.001

Body mass index 0.99 [0.96;1.02] 0.455Waist circumference 1.02 [1.01;1.03] 0.003Waist-to-height ratio 5.27 [0.83;33.6] 0.079Hypertension 1.10 [0.79;1.53] 0.578Type-2 diabetes 1.88 [1.46;2.44] <0.001Dyslipidemia 0.62 [0.49;0.80] <0.001Family history of premature CHD 0.93 [0.68;1.26] 0.640Hormone-replacement therapy 0.29 [0.04;2.10] 0.223MeDiet Adherence score 0.88 [0.83;0.94] <0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 19 / 36

Page 20: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Costumazing the table

> males<-update(restab,x=update(res, .~.-sex,subset=sex=='Male'),hide=NA)

> females<-update(restab,x=update(res, .~.-sex,subset=sex=='Female'),hide=NA)

> tabcomb<-cbind("Males"=males,"Females"=females)

Males FemalesHR p.ratio HR p.ratio

Intervention group:Control Ref. Ref. Ref. Ref.MedDiet + Nuts 0.54 [0.36;0.80] 0.002 0.78 [0.48;1.26] 0.305MedDiet + VOO 0.71 [0.49;1.03] 0.071 0.69 [0.43;1.10] 0.116

Age 1.06 [1.03;1.08] <0.001 1.10 [1.07;1.14] <0.001Smoking:

Never Ref. Ref. Ref. Ref.Current 1.63 [0.99;2.69] 0.056 1.94 [0.97;3.84] 0.059Former 1.92 [1.23;3.00] 0.004 0.43 [0.14;1.35] 0.147

Body mass index 1.01 [0.97;1.06] 0.565 0.99 [0.94;1.04] 0.685Waist circumference 1.01 [0.99;1.02] 0.391 1.01 [1.00;1.03] 0.150Waist-to-height ratio 13.2 [0.85;205] 0.065 13.5 [0.89;204] 0.061Hypertension 1.20 [0.81;1.79] 0.358 1.31 [0.70;2.46] 0.393Type-2 diabetes 1.59 [1.14;2.22] 0.006 2.12 [1.41;3.18] <0.001Dyslipidemia 0.81 [0.58;1.11] 0.191 0.52 [0.35;0.78] 0.001Family history of premature CHD 0.89 [0.57;1.41] 0.627 1.18 [0.77;1.82] 0.448Hormone-replacement therapy Ref. Ref. 0.42 [0.06;2.98] 0.383MeDiet Adherence score 0.87 [0.81;0.94] 0.001 0.88 [0.80;0.97] 0.012

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 20 / 36

Page 21: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Methods/functions on tables

> varinfo(restab)

--- Analyzed variable names ----

Orig varname Shown varname1 tevent tevent2 group Intervention group3 sex Sex4 age Age5 smoke Smoking6 bmi Body mass index7 waist Waist circumference8 wth Waist-to-height ratio9 htn Hypertension10 diab Type-2 diabetes11 hyperchol Dyslipidemia12 famhist Family history of premature CHD13 hormo Hormone-replacement therapy14 p14 MeDiet Adherence score

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 21 / 36

Page 22: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Methods/functions on tables

> summary(restab)

---Available data----

____________________________________________________________________________________________[ALL] No event Event method select Fact OR/HR

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯Intervention group 6324 6072 252 categorical ALL --Sex 6324 6072 252 categorical ALL --Age 6324 6072 252 continuous-normal ALL 1Smoking 6324 6072 252 categorical ALL --Body mass index 6324 6072 252 continuous-normal ALL 1Waist circumference 6324 6072 252 continuous-normal ALL 1Waist-to-height ratio 6324 6072 252 continuous-normal ALL 1Hypertension 6324 6072 252 categorical ALL --Type-2 diabetes 6324 6072 252 categorical ALL --Dyslipidemia 6324 6072 252 categorical ALL --Family history of premature CHD 6324 6072 252 categorical ALL --Hormone-replacement therapy 5661 5437 224 categorical ALL --MeDiet Adherence score 6324 6072 252 continuous-non-normal ALL 1¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 22 / 36

Page 23: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Methods/functions on tables

> restab[1:5]

--------Summary descriptives table by 'tevent'---------

____________________________________________HR p.ratio

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯Intervention group:

Control Ref. Ref.MedDiet + Nuts 0.66 [0.48;0.89] 0.008MedDiet + VOO 0.70 [0.53;0.94] 0.018

Sex: Male Ref. Ref.Age 1.06 [1.04;1.09] <0.001Smoking:

Never Ref. Ref.Current 1.96 [1.40;2.74] <0.001Former 2.02 [1.53;2.67] <0.001

Body mass index 0.99 [0.96;1.02] 0.455¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 23 / 36

Page 24: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Missingness

REGICOR data

1995 2000 2005p.overall

N=431 N=786 N=1077

Age 54.1 (11.7) 54.3 (11.2) 55.3 (10.6) 0.078Sex: 0.506

Male 206 (47.8%) 390 (49.6%) 505 (46.9%)Female 225 (52.2%) 396 (50.4%) 572 (53.1%)

Smoking status: <0.001Never smoker 234 (56.4%) 414 (54.6%) 553 (52.2%)Current or former < 1y 109 (26.3%) 267 (35.2%) 217 (20.5%)Former ≥ 1y 72 (17.3%) 77 (10.2%) 290 (27.4%)

Systolic blood pressure 133 (19.2) 133 (21.3) 129 (19.8) <0.001Diastolic blood pressure 77.0 (10.5) 80.8 (10.3) 79.9 (10.6) <0.001History of hypertension 111 (25.8%) 233 (29.6%) 379 (35.5%) <0.001Hypertension treatment 71 (16.5%) 127 (16.2%) 230 (22.2%) 0.002Total cholesterol 225 (43.1) 224 (44.4) 213 (45.9) <0.001HDL cholesterol 51.9 (14.5) 52.3 (15.6) 53.2 (14.2) 0.208Triglycerides 114 (74.4) 114 (70.7) 117 (76.0) 0.582LDL cholesterol 152 (38.4) 149 (38.6) 136 (39.7) <0.001History of hyperchol. 97 (22.5%) 256 (33.2%) 356 (33.2%) <0.001Cholesterol treatment 28 (6.50%) 68 (8.80%) 132 (12.8%) <0.001Height (cm) 163 (9.21) 162 (9.39) 163 (9.05) 0.003Weight (Kg) 72.3 (12.6) 73.8 (14.0) 73.6 (13.9) 0.150Body mass index 27.0 (4.15) 28.1 (4.62) 27.6 (4.63) <0.001Physical activity (Kcal/week) 491 (419) 422 (377) 351 (378) <0.001Physical component 49.3 (8.08) 49.0 (9.63) 50.1 (8.91) 0.032Mental component 49.2 (11.3) 48.9 (11.0) 46.9 (10.8) <0.001Cardiovascular event 10 (2.51%) 35 (4.72%) 47 (4.59%) 0.161Days to cardiovascular event or end of follow-up 1784 (1101) 1686 (1080) 1793 (1072) 0.099Overall death 18 (4.65%) 81 (11.0%) 74 (7.23%) <0.001Days to overall death or end of follow-up 1713 (1042) 1674 (1050) 1758 (1055) 0.252

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 24 / 36

Page 25: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Missingness

Missing table> mistab<-missingTable(regtab)

1995 2000 2005p.overall

N=431 N=786 N=1077

Age 0 (0.00%) 0 (0.00%) 0 (0.00%) 1.000Sex 0 (0.00%) 0 (0.00%) 0 (0.00%) 1.000Smoking status 16 (3.71%) 28 (3.56%) 17 (1.58%) 0.010Systolic blood pressure 3 (0.70%) 11 (1.40%) 0 (0.00%) <0.001Diastolic blood pressure 3 (0.70%) 11 (1.40%) 0 (0.00%) <0.001History of hypertension 0 (0.00%) 0 (0.00%) 8 (0.74%) 0.015Hypertension treatment 0 (0.00%) 0 (0.00%) 43 (3.99%) <0.001Total cholesterol 28 (6.50%) 71 (9.03%) 2 (0.19%) <0.001HDL cholesterol 30 (6.96%) 38 (4.83%) 1 (0.09%) <0.001Triglycerides 28 (6.50%) 34 (4.33%) 1 (0.09%) <0.001LDL cholesterol 43 (9.98%) 98 (12.5%) 27 (2.51%) <0.001History of hyperchol. 0 (0.00%) 15 (1.91%) 6 (0.56%) 0.001Cholesterol treatment 0 (0.00%) 13 (1.65%) 42 (3.90%) <0.001Height (cm) 8 (1.86%) 15 (1.91%) 12 (1.11%) 0.318Weight (Kg) 8 (1.86%) 15 (1.91%) 12 (1.11%) 0.318Body mass index 8 (1.86%) 15 (1.91%) 12 (1.11%) 0.318Physical activity (Kcal/week) 64 (14.8%) 22 (2.80%) 2 (0.19%) <0.001Physical component 34 (7.89%) 123 (15.6%) 83 (7.71%) <0.001Mental component 34 (7.89%) 123 (15.6%) 83 (7.71%) <0.001Cardiovascular event 33 (7.66%) 45 (5.73%) 53 (4.92%) 0.118Days to cardiovascular event or end of follow-up 33 (7.66%) 45 (5.73%) 53 (4.92%) 0.118Overall death 44 (10.2%) 48 (6.11%) 54 (5.01%) 0.001Days to overall death or end of follow-up 44 (10.2%) 48 (6.11%) 54 (5.01%) 0.001

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 25 / 36

Page 26: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Missingness

Include NA as new category:> regtab2<-update(regtab,x=update(res,include.miss=TRUE))

1995 2000 2005p.overall

N=431 N=786 N=1077

Age 54.1 (11.7) 54.3 (11.2) 55.3 (10.6) 0.078Sex: 0.506

Male 206 (47.8%) 390 (49.6%) 505 (46.9%)Female 225 (52.2%) 396 (50.4%) 572 (53.1%)

Smoking status: <0.001Never smoker 234 (54.3%) 414 (52.7%) 553 (51.3%)Current or former < 1y 109 (25.3%) 267 (34.0%) 217 (20.1%)Former ≥ 1y 72 (16.7%) 77 (9.80%) 290 (26.9%)<Missing> 16 (3.71%) 28 (3.56%) 17 (1.58%)

Systolic blood pressure 133 (19.2) 133 (21.3) 129 (19.8) <0.001Diastolic blood pressure 77.0 (10.5) 80.8 (10.3) 79.9 (10.6) <0.001History of hypertension: <0.001

Yes 111 (25.8%) 233 (29.6%) 379 (35.2%)No 320 (74.2%) 553 (70.4%) 690 (64.1%)<Missing> 0 (0.00%) 0 (0.00%) 8 (0.74%)

Hypertension treatment: <0.001No 360 (83.5%) 659 (83.8%) 804 (74.7%)Yes 71 (16.5%) 127 (16.2%) 230 (21.4%)<Missing> 0 (0.00%) 0 (0.00%) 43 (3.99%)

Total cholesterol 225 (43.1) 224 (44.4) 213 (45.9) <0.001HDL cholesterol 51.9 (14.5) 52.3 (15.6) 53.2 (14.2) 0.208Triglycerides 114 (74.4) 114 (70.7) 117 (76.0) 0.582LDL cholesterol 152 (38.4) 149 (38.6) 136 (39.7) <0.001History of hyperchol.: <0.001

Yes 97 (22.5%) 256 (32.6%) 356 (33.1%)No 334 (77.5%) 515 (65.5%) 715 (66.4%)<Missing> 0 (0.00%) 15 (1.91%) 6 (0.56%)

Cholesterol treatment: <0.001No 403 (93.5%) 705 (89.7%) 903 (83.8%)Yes 28 (6.50%) 68 (8.65%) 132 (12.3%)<Missing> 0 (0.00%) 13 (1.65%) 42 (3.90%)

Height (cm) 163 (9.21) 162 (9.39) 163 (9.05) 0.003Weight (Kg) 72.3 (12.6) 73.8 (14.0) 73.6 (13.9) 0.150Body mass index 27.0 (4.15) 28.1 (4.62) 27.6 (4.63) <0.001Physical activity (Kcal/week) 491 (419) 422 (377) 351 (378) <0.001Physical component 49.3 (8.08) 49.0 (9.63) 50.1 (8.91) 0.032Mental component 49.2 (11.3) 48.9 (11.0) 46.9 (10.8) <0.001Cardiovascular event: 0.097

No 388 (90.0%) 706 (89.8%) 977 (90.7%)Yes 10 (2.32%) 35 (4.45%) 47 (4.36%)<Missing> 33 (7.66%) 45 (5.73%) 53 (4.92%)

Days to cardiovascular event or end of follow-up 1784 (1101) 1686 (1080) 1793 (1072) 0.099Overall death: <0.001

No 369 (85.6%) 657 (83.6%) 949 (88.1%)Yes 18 (4.18%) 81 (10.3%) 74 (6.87%)<Missing> 44 (10.2%) 48 (6.11%) 54 (5.01%)

Days to overall death or end of follow-up 1713 (1042) 1674 (1050) 1758 (1055) 0.252

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 26 / 36

Page 27: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Exporting the table

to LATEX> export2latex(restab,"table1")

to ASCII (csv)> export2csv(restab,"table1")

to HTML> export2html(restab,"table1")

to PDF> export2pdf(restab,"table1")

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 27 / 36

Page 28: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

By syntax Summary of genetic data

> compareSNPs( ~ snp10001+snp10002+snp10003+snp10004+

+ snp10005+snp10006+snp10007+snp10008, SNPs)

*********** Summary of genetic data (SNPs) ***********

_____________________________________________________

SNP Ntyped MAF Genotypes Genotypes.p HWE.p

=====================================================

snp10001 157 24.5% TT|TC|CC 58.6|33.8|7.6 0.353

snp10002 157 28.0% CC|CA|AA 47.1|49.7|3.2 0.006

snp10003 144 100.0% GG 100.0| 0.0|0.0 1.000

snp10004 156 100.0% GG 100.0| 0.0|0.0 1.000

snp10005 157 24.2% GG|GA|AA 53.5|44.6|1.9 0.012

snp10006 157 100.0% AA 100.0| 0.0|0.0 1.000

snp10007 157 100.0% CC 100.0| 0.0|0.0 1.000

snp10008 157 19.7% CC|CG|GG 66.2|28.0|5.7 0.215

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 28 / 36

Page 29: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

GUI

> cGroupsGUI()

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 29 / 36

Page 30: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Web User Interface

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 30 / 36

Page 31: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Web User Interface

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 31 / 36

Page 32: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Web User Interface

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 32 / 36

Page 33: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Web User Interface

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 33 / 36

Page 34: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Web site

compareGroups web site

http://www.comparegroups.eu

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 34 / 36

Page 35: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

Future works

Future works

Develop WUI and website

Implement other tabular environments when exporting to

LATEX.

Export to Word (explore R2wd package).

. . .

Suggestions

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 35 / 36

Page 36: compareGroups updated: version 2 · 2013-11-19 · compareGroups updated: version 2.0 Isaac Subirana & Joan Vila & H ector Sanz & Judith Pen~a el & Gavin Lucas & David Gim enez isubirana@imim.es,

THANK YOU!

¡MUCHAS GRACIAS!

MOLTES GRACIES!

Don’t hesitate to contact us:

Isaac Subirana < [email protected] >Joan Vila < [email protected] >

Isaac Subirana & Joan Vila (RICAD) compareGroups updated: version 2.0 July 10-12, 2013 36 / 36