Example: biology

Structural Equation Modeling with categorical variables

Department of Data AnalysisGhent UniversityStructural Equation Modeling with categoricalvariablesYves RosseelDepartment of Data AnalysisGhent UniversitySummer School Using R for personality researchAugust 23 28, 2014 Bertinoro, ItalyYves RosseelStructural Equation Modeling with categorical variables1 / 96 Department of Data AnalysisGhent UniversityContents1 Structural Equation Modeling with categorical data analysis .. logistic regression model .. probit regression model .. with an ordinal response .. with categorical (endogenous) variables : two approaches .. group analysis with categorical data .. information approach: marginal maximum likelihood .. : pairwise maximum likelihood ..94 Yves RosseelStructural Equation Modeling with categorical variables2 / 96 Department of Data AnalysisGhent University1 Structural Equation Modeling with categorical categorical data analysiscontinuous/numerical data interval or ratio scale ( income, height, weight, age, reaction time, bloodpressure.)

Department of Data Analysis Ghent University endogenous versus exogenous •the categorical variables are exogenous only – for example, ANOVA – standard approach: convert to dummy variables (if the categorical vari-

Tags:

  Structural, Equations, Structural equation

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Structural Equation Modeling with categorical variables

1 Department of Data AnalysisGhent UniversityStructural Equation Modeling with categoricalvariablesYves RosseelDepartment of Data AnalysisGhent UniversitySummer School Using R for personality researchAugust 23 28, 2014 Bertinoro, ItalyYves RosseelStructural Equation Modeling with categorical variables1 / 96 Department of Data AnalysisGhent UniversityContents1 Structural Equation Modeling with categorical data analysis .. logistic regression model .. probit regression model .. with an ordinal response .. with categorical (endogenous) variables : two approaches .. group analysis with categorical data .. information approach: marginal maximum likelihood .. : pairwise maximum likelihood ..94 Yves RosseelStructural Equation Modeling with categorical variables2 / 96 Department of Data AnalysisGhent University1 Structural Equation Modeling with categorical categorical data analysiscontinuous/numerical data interval or ratio scale ( income, height, weight, age, reaction time, bloodpressure.)

2 categorical /discrete data limited set of possible outcomes/categories nominal or binary: gender, dead/alive, country, race/ethnicity, .. ordinal: ses (high, middle, low), age group (young, middle, old), likert scales(agree strongly, agree, neutral, disagree, disagree strongly) counts: number of deadly accidents this weekYves RosseelStructural Equation Modeling with categorical variables3 / 96 Department of Data AnalysisGhent Universitycategorical data analysis (regression models:) response/dependent variable is a categorical variable probit/logistic regression multinomial regression ordinal logit/probit regression Poisson regression generalized linear (mixed) models all (dependent) variables are categorical (contingency tables, loglinear anal-ysis) other analyses: exploratory/confirmatory factor analysis with binary/ordered data (ItemResponse Theory, IRT) Structural Equation Modeling with binary/ordered data.

3 Yves RosseelStructural Equation Modeling with categorical variables4 / 96 Department of Data AnalysisGhent Universityendogenous versus exogenous the categorical variables are exogenous only for example, ANOVA standard approach: convert to dummy variables (if the categorical vari-able hasKlevels, we only needK 1dummy variables ) many functions in R do this automatically (lm(),glm(),lme(),lmer(), .. if the categorical variable has been declared as a factor ) but NOT in lavaan; you have to manually construct the dummy vari-ables yourself (before calling any of the lavaan fitting functions) the same for interaction terms (product terms), quadratic terms, .. binary exogenous variables : should be coded as 0/1 or 1/2 if the categorical variables are endogenous, we need special methodsYves RosseelStructural Equation Modeling with categorical variables5 / 96 Department of Data AnalysisGhent The logistic regression model generalized linear model (GLM) with binomial random component and logitlink function the logistic regression model with 1 (continuous) predictor:log( (x)1 (x))=logit[ (x)] = 0+ 1xwhere (x)denotes the probability of successP(y= 1|x) 1represents the change per unit increase inx in the logit value logit[ (x)] relationship between (x)andx.

4 (x) =exp( 0+ 1x)1 + exp( 0+ 1x) the sign of 1determines whether (x)is increasing or decreasing the rate of change in (x) per unit increase inx varies (slower when (x)approaches 0 or 1)Yves RosseelStructural Equation Modeling with categorical variables6 / 96 Department of Data AnalysisGhent University exponentiating both sides of the model gives: (x)1 (x)= exp ( 0+ 1x)theoddsincrease/decrease multiplicatively byexp( 1)per unit increase inx; if(x2 x1) = 1:odds(x2) =odds(x1) exp( 1) exp( 1)is theodds ratiocorresponding to the2 2table with columns(y= 1andy= 0) and rows (x+ 1andx):y= 1y= 0x+ 1 11 12x 21 22with s the expected/fitted frequencies in each cell; the odds ratio for this2 2table is( 11 22)/( 12 21) = exp( 1)Yves RosseelStructural Equation Modeling with categorical variables7 / 96 Department of Data AnalysisGhent Universityhorseshoe crab mating example (binary version) 173 horseshoe crabs y= female crab has at least one satellite (y= 1) or none (y= 0) x= carapace width (cm)At least one satellite (y)Width (x).

5 Yves RosseelStructural Equation Modeling with categorical variables8 / 96 Department of Data AnalysisGhent UniversityYves RosseelStructural Equation Modeling with categorical variables9 / 96 Department of Data AnalysisGhent UniversityR code> Crabs <- (" ", header=T)> Crabs$y <- ifelse(Crabs$Sa > 0, 1, 0)> fit <- glm(y W, data=Crabs, family=binomial)> summary(fit)Call:glm(formula = y W, family = binomial, data = Crabs)Deviance Residuals:Min 1Q Median 3Q :Estimate Std. Error z value Pr(>|z|)(Intercept) **W **---Signif. codes: 0** ** * . 1(Dispersion parameter for binomial family taken to be 1)Null deviance: on 172 degrees of freedomResidual deviance: on 171 degrees of freedomAIC: of Fisher Scoring iterations: 4 Yves RosseelStructural Equation Modeling with categorical variables10 / 96 Department of Data AnalysisGhent Universityresults logistic regression model the model predicts:logit[ (x)] = + Width in terms of the probability success.

6 (x) =exp( + Width)1 + exp( + Width) the predicted probability success for some values ofx(=Width) (x= 22) = (x= 24) = (x= 26) = (x= 28) = (x= 30) = RosseelStructural Equation Modeling with categorical variables11 / 96 Department of Data AnalysisGhent Universityplot probability of success as a function of of success(x)Yves RosseelStructural Equation Modeling with categorical variables12 / 96 Department of Data AnalysisGhent University the exponentiated coefficients:exp( 0)exp( 1) interpretation: for a 1-unit change in x, theoddsincrease multiplicativelyby the predicted odds for some values ofx(=Width)odds(x= 22) = (x= 24) = (x= 26) = (x= 28) = (x= 30) = (x= 30) =odds(x= 28) exp( (30 28)) = RosseelStructural Equation Modeling with categorical variables13 / 96 Department of Data AnalysisGhent Universityplot odds as a function of Wlllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllll222426283032340204060 Wodds(x)Yves RosseelStructural Equation Modeling with categorical variables14 / 96 Department of Data AnalysisGhent University the relationship between the logits andxis linear.

7 Logit[ (x)] = + Width the predicted logits for some values ofx(=Width)logit[ (x= 22)] = [ (x= 24)] = [ (x= 26)] = [ (x= 28)] = [ (x= 30)] = RosseelStructural Equation Modeling with categorical variables15 / 96 Department of Data AnalysisGhent Universityplot logits as a function of Wlllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllll22242628303234 2 101234 Wlogit(x)Yves RosseelStructural Equation Modeling with categorical variables16 / 96 Department of Data AnalysisGhent The probit regression model GLM with binomial random component and probit link function nonlinear relationship between (x)andx: (x) = ( 0+ 1x) is standard normal cumulative distribution function (cdf) using the probit link function: 1[ (x)] =probit[ (x)] = 0+ 1x 1: represents the change in the probit value (per unit change inx) other cdf s are possible: the logit transformation is simply the inverse func-tion for the standard logistic cdf these are calledinverse CDF link functionsYves RosseelStructural Equation Modeling with categorical variables17 / 96 Department of Data AnalysisGhent UniversityR code> fit <- glm(y W, data=Crabs, family=binomial(link = "probit"))> summary(fit)Call:glm(formula = y W, family = binomial(link = "probit"), data = Crabs)Deviance Residuals:Min 1Q Median 3Q :Estimate Std.

8 Error z value Pr(>|z|)(Intercept) **W **---Signif. codes: 0** ** * . 1(Dispersion parameter for binomial family taken to be 1)Null deviance: on 172 degrees of freedomResidual deviance: on 171 degrees of freedomAIC: of Fisher Scoring iterations: 5 Yves RosseelStructural Equation Modeling with categorical variables18 / 96 Department of Data AnalysisGhent Universityresults probit regression model the model predicts:probit[ (x)] = + Width in terms of the probability success: (x) = ( + Width) the predicted probability success for some values ofx(=Width) (x= 22) = (x= 24) = (x= 26) = (x= 28) = (x= 30) = RosseelStructural Equation Modeling with categorical variables19 / 96 Department of Data AnalysisGhent University computing predicted probabilities in R> pnorm( + *c(22,24,26,28,30) )[1] or by using the predict() function with new data.

9 > # create `new' data in a > W <- (W=c(22,24,26,28,30))> WW1 222 243 264 285 30> # predict probabilities> predict(fit, newdata=W, type="response")1 2 3 4 RosseelStructural Equation Modeling with categorical variables20 / 96 Department of Data AnalysisGhent Universityplot probability of success as a function of of success(x)Yves RosseelStructural Equation Modeling with categorical variables21 / 96 Department of Data AnalysisGhent Universityplot probits as a function of Wlllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllll llllllllllllll22242628303234 1012 Wprobit(x)Yves RosseelStructural Equation Modeling with categorical variables22 / 96 Department of Data AnalysisGhent Regression with an ordinal responsecumulative probabilities ordinal variableywithKordered levels:k= 1,2,3.

10 ,K probabilityP(y=k): 1, 2,.., K cumulative probabilities:P(y 1) = 1P(y 2) = 1+ 2P(y 3) = 1+ 2+ (y K 1) = 1+ 2+ 3+..+ K 1P(y K) = 1 Yves RosseelStructural Equation Modeling with categorical variables23 / 96 Department of Data AnalysisGhent Universitycumulative logitscumulative logitsfork= 1,2,..,K 1:logitP(y k) = log(P(y k)1 P(y k))= log(P(y k)P(y > k))= log( 1+..+ k k+1+.. K) allKprobabilities are used for each logit each logit resembles a binary logit with two categories:1. the categories 1 tok, and2. the categoriesk+ RosseelStructural Equation Modeling with categorical variables24 / 96 Department of Data AnalysisGhent Universityproportional odds model a model that simultaneously uses all cumulative logits islog( 1+..+ k k+1+.. K)= 0k+ 1xwherek= 1,2,..,K 1. each cumulative logit has its own intercept 0k( threshold );the{ 0k}are increasing ink.


Related search queries