Longitudinal Models - Lecture 12

3y ago
269.14 KB
20 Pages
Last View : 15d ago
Last Download : 4m ago
Upload by : Aiyana Dorn

Longitudinal ModelsLecture 12Nicholas ChristianBIOST 2094 Spring 2011

GEEMixed ModelsFrailty ModelsOutline1. GEE Models2. Mixed Models3. Frailty Models2 of 20

GEEMixed ModelsFrailty ModelsGeneralized Estimating Equations Population-average or marginal model, provides a regression approach forgeneralized linear models when the responses are not independent(correlated/clustered data) Goal is to make inferences about the population, accounting for thewithin-subject correlation The packages gee and geepack are used for GEE models in R The major difference between gee and geepack is that geepack containsan ANOVA method that allows us to compare models and perform Waldtests.3 of 20

GEEMixed ModelsFrailty ModelsGeneralized Estimating Equations Basic Syntax for geeglm() from the geepack package; has a syntax verysimilar to glm()geeglm(formula, family gaussian, data, id, zcor NULL, constr,std.err lic description of the model to be fittedDescription of the error distribution and link functionOptional dataframeVector that identifies the clustersEnter a user defined correlation structureWorking correlation structure:"independence", "exchangeable", "ar1", "unstructured","userdefined"Type of standard error to be calculated.Default "san.se" is the robust (sandwich) estimate;use "jack" for approximate jackknife variance estimate4 of 20

GEEMixed ModelsFrailty ModelsCorrelation Structure Independence, 1 00 Exchangeable,1 ρρ Autoregressive order 1,1 ρρ2 Unstructured,1 ρ12ρ13010ρ1ρρ1ρρ121ρ23 00 1 ρρ 1 ρ2ρ 1 ρ13ρ23 1 GEE model will give valid results with a misspecified correlation structurewhen the sandwich variance estimator is used5 of 20

GEEMixed ModelsFrailty ModelsInference For a geeglm object returned by geeglm(), the functions drop1(),confint() and step() do not apply; however anova() does apply. The function esticon() in the doBy package computes and test linearfunctions of the regression parameters for lm, glm and geeglm objects Basic syntax,esticon(obj, cm, beta0, joint.test FALSE)objcmbeta0joint.testModel objectMatrix specifying linear functions of the regression parameters(one linear function per row and one column for each parameter)Vector of numbersIf TRUE joint Wald test of the hypothesis Lbeta beta0 is made,default is one test for each row, (Lbeta).i beta0.i6 of 20

GEEMixed ModelsFrailty Modelsesticon() Let β̂ (βˆ1 , . . . , βˆp ) denote the estimated parameters. Also letk (k1 , . . . , kp ) denote a vector of constants; one row of the matrix for thecm argument. Then c k T β k1 β1 . . . kp βp . esticon() calculates the linear combinations of the parameter estimatesc, the standard error and the confidence interval Specify a value for beta0 to test H0 : c beta0 If joint.test TRUE then all of the linear combinations are tested jointly7 of 20

GEEMixed ModelsFrailty ModelsExample - GEE# Install and load package # ohio dataset from geepack - Health effect of air pollution# Children followed for four years, wheeze status recorded annuallydata(ohio) # Load the datasethead(ohio)str(ohio)# Response is binary - fit a logistic GEE model# Treat time (age) as continuousfit.exch - geeglm(resp age smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")fit.unstr - geeglm(resp age smoke, family binomial(link "logit"),data ohio, id id, corstr "unstructured", std.err "san.se")summary(fit.exch)summary(fit.unstr)8 of 20

GEEMixed ModelsFrailty ModelsExample - GEE# Treat time (age) as categoricalfit - geeglm(resp factor(age) smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")summary(fit)# Test the effect of smoke using anova()fit1 - geeglm(resp factor(age) smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")fit2 - geeglm(resp factor(age), family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")anova(fit1, fit2)# Individual Wald test and confidence interval for each parameterest - esticon(fit, diag(5))# Odds ratio and confidence intervalsOR.CI - exp(cbind(est Estimate, est Lower.CI, est Upper.CI))rownames(OR.CI) - names(coef(fit))colnames(OR.CI) - c("OR", "Lower OR", "Upper OR")9 of 20

GEEMixed ModelsFrailty ModelsExample - GEE# Odds ratio of wheezing for a 9-year old with a mother who smoked# during the first year of the study compared to an 8-year old with a# mother who did not smoke during the first year of the study# That is estimate, [smoke factor(age)0] - [factor(age)-1]esticon(fit, c(0,-1,1,0,1))exp(.Last.value Estimate)# 9-year old with mother who smoked is at greater risk of wheezing# Jointly test effects using esticon()fit - geeglm(resp factor(age)*smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")summary(fit)L cbind(matrix(0, nrow 3, ncol 5), diag(3))esticon(fit, L, joint.test TRUE)# Could also use anova()fit1 - geeglm(resp factor(age)*smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")fit2 - geeglm(resp factor(age) smoke, family binomial(link "logit"),data ohio, id id, corstr "exchangeable", std.err "san.se")10 of 20anova(fit1, fit2)

GEEMixed ModelsFrailty ModelsMixed Models Subject-specific or cluster-specific model of correlated/clustered data Basic premise is that there is natural heterogeneity across individuals in thestudy population that is the result of unobserved covariates; random effectsaccount for the unobserved covariates. The lme4 package contains functions for fitting linear mixed models,generalized linear mixed models and nonlinear mixed models The lme4 package uses S4 classes and methods. Information in S4 classes is organized into slots. Each slot is named andrequires a specified class. Use the @ to extract information from a slot. To get the names of the slots use, getSlots("class name ") For more information about fitting mixed models in R using lme4 see theavailable vignettes, vignette(package "lme4")11 of 20

GEEMixed ModelsFrailty Modelslmer() The lmer() function in the lme4 package is used to fit linear andgeneralized linear models. Basic syntax,lmer(formula, data, family NULL, REML TRUE)formuladatafamilyREMLSymbolic description of the model to be fittedOptional dataframeDescription of the error distribution and link function,if NULL a linear mixed model is fittedLogical, if TRUE estimate using REML (provides a consistentestimate of the variance components); if FALSE estimate using ML lmer() returns a mer object; see ?"mer-class" for an explanation of theslots of mer12 of 20

GEEMixed ModelsFrailty ModelsFormula lmer() A random-effects term in lmer() is specified by a linear model term and agrouping factor separated by ’ ’; i.e. a random effect is a linear model termconditional on the level of the grouping factor. The entire random-effects expression should be enclosed in parenthesessince the precedence of ’ ’ as an operator is lower than most otheroperators used in linear model formulas For example, Random intercept,lmer(Reaction Days (1 Subject), data sleepstudy) Random intercept and slope,lmer(Reaction Days (Days Subject), data sleepstudy) See the vignettes for how to fit nested random effects,vignette(package "lme4")13 of 20

GEEMixed ModelsFrailty ModelsInference Functions used for inference and ls()Summarize model resultsSequential tests of fixed effects and model comparisonExtract variance componentsPredict random effectsExtract residuals See ?"mer-class" for a complete list of available methods14 of 20

GEEMixed ModelsFrailty ModelsExample - Mixed Models# Install and load lme4 packageinstall.packages("lme4")libary(lme4)# Sleep data# Average reaction time per day for subjects in a sleep deprivation y)# Trellis plot of data# Clear that there are different intercepts and slopes for each subject# type c("g","p","r"), plots grid lines, points, and regression linexyplot(Reaction Days Subject, data sleepstudy,type c("g","p","r"),xlab "Days of sleep deprivation",ylab "Average reaction time (ms)", aspect "xy")15 of 20

GEEMixed ModelsFrailty ModelsExample - Mixed Models# Random intercept modelfit1 - lmer(Reaction Days (1 Subject), data sleepstudy)summary(fit1)# Extract informationnames(fit1)# S4 class need to look at the slotsgetSlots("mer") # Slot names for a mer object returned by lmer()fit1@deviance# Get deviancesum.fit1 - )sum.fit1@coefsVarCorr(fit1)# Additional information returned by summary# Coefficients# Extract variance estimates16 of 20

GEEMixed ModelsFrailty ModelsExample - Mixed Models# Modely.hatint.hatres.hatDiagnostics - fitted(fit1)# Fitted values - ranef(fit1)[[1]][[1]] # Predicted intercepts - residuals(fit1)# Estimated residualsqqnorm(int.hat, main "Random Intercepts"); qqline(int.hat)qqnorm(res.hat, main "Residuals"); qqline(res.hat)plot(y.hat, res.hat, xlab "Fitted Values", ylab "Residuals")abline(h 0, lty 2)# Random intercept and slope modelfit2 - lmer(Reaction Days (Days Subject), data sleepstudy)summary(fit2)# Make outcome a binary variablesleepstudy react.YesNo - with(sleepstudy, cut(Reaction,breaks c(min(Reaction), mean(Reaction), max(Reaction)),labels c("Yes", "No")))# Generalized linear mixed model - binomial outcomelmer(react.YesNo Days (Days Subject),data sleepstudy, family binomial)17 of 20

GEEMixed ModelsFrailty ModelsFrailty Models Frailty models are used to model correlated survival data This could be recurrent failures on the same subject or clustered eventtimes Similar to a mixed model with a random intercept Suppose V is an independent identically distributed random variable thenthe frailty model given V v for time T is,h(t v ) h0 (t)exp(X β v )18 of 20

GEEMixed ModelsFrailty ModelsFrailty Models To fit a frailty model in R use coxph() along with the function frailty()on the right-hand side of the formula The argument of frailty() is the variable to be added as a randomeffect; such as an ID variable for a subject-specific modelfrailty()Gamma/Normal frailty, specify the distributionfrailty.gamma()Gamma frailtyfrailty.gaussian() Normal frailty Functions that apply to Cox models also apply to frailty models Several other packages exist for analyzing frailty models, see the CRANTask View: Survival Analysis for more rvival.html19 of 20

GEEMixed ModelsFrailty ModelsExample - Frailty Modelslibrary(survival)# A catheter is inserted and ramains in place until an infection occurs.# Then the catheter is removed and is reinserted after the infection has# cleared up. Subjects may have several infections, time is recorded# from insertion to the next infection (assume no carry over effects)head(kidney)str(kidney)# Cox model without accounting for the correlationcoxph(Surv(time, status) age sex disease, data kidney)# Cox model with a frailty term accounting for the correlation# Assuming a normally distributed frailty termfit - coxph(Surv(time, status) age sex disease frailty.gaussian(id),data kidney)# Functions that apply to Cox models also apply to frailty modelssummary(fit)confint(fit)anova(fit)drop1(fit, .)step(fit)20 of 20

Lecture 12 Nicholas Christian BIOST 2094 Spring 2011. GEE Mixed Models Frailty Models Outline 1.GEE Models 2.Mixed Models 3.Frailty Models 2 of 20. GEE Mixed Models Frailty Models Generalized Estimating Equations Population-average or marginal model, provides a regression approach for . Frailty models a

Related Documents:

Introduction of Chemical Reaction Engineering Introduction about Chemical Engineering 0:31:15 0:31:09. Lecture 14 Lecture 15 Lecture 16 Lecture 17 Lecture 18 Lecture 19 Lecture 20 Lecture 21 Lecture 22 Lecture 23 Lecture 24 Lecture 25 Lecture 26 Lecture 27 Lecture 28 Lecture

Lecture 1: A Beginner's Guide Lecture 2: Introduction to Programming Lecture 3: Introduction to C, structure of C programming Lecture 4: Elements of C Lecture 5: Variables, Statements, Expressions Lecture 6: Input-Output in C Lecture 7: Formatted Input-Output Lecture 8: Operators Lecture 9: Operators continued

PCA: hypothesis-free approach to analyze longitudinal trends in myopia progression. Hopefully, this presentation can suggest some ideas on how longitudinal data can be used for prediction, and how dimension reduction techniques can be used in longitudinal data analysis. Longitudinal Prediction Feb 3, 2015 33 / 33

Lecture 1: Introduction and Orientation. Lecture 2: Overview of Electronic Materials . Lecture 3: Free electron Fermi gas . Lecture 4: Energy bands . Lecture 5: Carrier Concentration in Semiconductors . Lecture 6: Shallow dopants and Deep -level traps . Lecture 7: Silicon Materials . Lecture 8: Oxidation. Lecture

TOEFL Listening Lecture 35 184 TOEFL Listening Lecture 36 189 TOEFL Listening Lecture 37 194 TOEFL Listening Lecture 38 199 TOEFL Listening Lecture 39 204 TOEFL Listening Lecture 40 209 TOEFL Listening Lecture 41 214 TOEFL Listening Lecture 42 219 TOEFL Listening Lecture 43 225 COPYRIGHT 2016

Partial Di erential Equations MSO-203-B T. Muthukumar tmk@iitk.ac.in November 14, 2019 T. Muthukumar tmk@iitk.ac.in Partial Di erential EquationsMSO-203-B November 14, 2019 1/193 1 First Week Lecture One Lecture Two Lecture Three Lecture Four 2 Second Week Lecture Five Lecture Six 3 Third Week Lecture Seven Lecture Eight 4 Fourth Week Lecture .

Longitudinal Data In health science, longitudinal studies are frequently designed to investigate changes over time. In contrast to cross-sectional data wherein measurements are required at only a single time point, longitudinal data have repeated measurements of outcome through a period of

Textbook of Algae , O. P. Sharma, Jan 1, 1986, Algae, 396 pages. Aimed to meet requirements of undergraduate students of botany. This book covers topics such as: evolution of sex and sexuality in algae; and, pigments in algae with their. An Introduction to Phycology , G. R. South, A. Whittick, Jul 8, 2009, Science, 352 pages. This text presents the subject using a systems approach and is .