Description Usage Format Source Examples

Dichotomous responses by 319 undergraduates to four questions about cheating behavior, and each student's academic GPA.

Students responded either (1) no or (2) yes as to whether they had ever lied to avoid taking an exam (`LIEEXAM`

), lied to avoid handing a term paper in on time (`LIEPAPER`

), purchased a term paper to hand in as their own or had obtained a copy of an exam prior to taking the exam (`FRAUD`

), or copied answers during an exam from someone sitting near to them (`COPYEXAM`

).

The `GPA`

variable is partitioned into five groups: (1) 2.99 or less; (2) 3.00-3.25; (3) 3.26-3.50; (4) 3.51-3.75; (5) 3.76-4.00.

This data set appears in Dayton (1998, pp. 33 and 85) as Tables 3.4 and 7.1.

1 |

A data frame with 319 observations on 5 variables. Note: GPA data were not available for four students who reported never cheating.

Dayton, C. Mitchell. 1998. *Latent Class Scaling Analysis*. Thousand Oaks, CA: SAGE Publications.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ```
##
## Replication of latent class models in Dayton (1998)
##
## Example 1. Two-class LCA. (Table 3.3, p. 32)
##
data(cheating)
f <- cbind(LIEEXAM,LIEPAPER,FRAUD,COPYEXAM)~1
ch2 <- poLCA(f,cheating,nclass=2) # log-likelihood: -440.0271
##
## Example 2. Two-class latent class regression using
## GPA as a covariate to predict class membership as
## "cheaters" vs. "non-cheaters".
## (Table 7.1, p. 85, and Figure 7.1, p. 86)
##
f2 <- cbind(LIEEXAM,LIEPAPER,FRAUD,COPYEXAM)~GPA
ch2c <- poLCA(f2,cheating,nclass=2) # log-likelihood: -429.6384
GPAmat <- cbind(1,c(1:5))
exb <- exp(GPAmat %*% ch2c$coeff)
matplot(c(1:5),cbind(1/(1+exb),exb/(1+exb)),type="l",lwd=2,
main="GPA as a predictor of persistent cheating",
xlab="GPA category, low to high",
ylab="Probability of latent class membership")
text(1.7,0.3,"Cheaters")
text(1.7,0.7,"Non-cheaters")
##
## Compare results from Example 1 to Example 2.
## Non-simultaneous estimation of effect of GPA on latent class
## membership biases the estimated effect in Example 1.
##
cheatcl <- which.min(ch2$P)
predcc <- sapply(c(1:5),function(v) mean(ch2$posterior[cheating$GPA==v,cheatcl],na.rm=TRUE))
## Having run Ex.2, add to plot:
matplot(c(1:5),cbind(1-predcc,predcc),type="l",lwd=2,add=TRUE)
text(4,0.14,"Cheaters\n (non-simul. estimate)")
text(4,0.87,"Non-cheaters\n (non-simul. estimate)")
``` |

```
Loading required package: scatterplot3d
Loading required package: MASS
Conditional item response (column) probabilities,
by outcome variable, for each class (row)
$LIEEXAM
Pr(1) Pr(2)
class 1: 0.4231 0.5769
class 2: 0.9834 0.0166
$LIEPAPER
Pr(1) Pr(2)
class 1: 0.4109 0.5891
class 2: 0.9708 0.0292
$FRAUD
Pr(1) Pr(2)
class 1: 0.7840 0.2160
class 2: 0.9629 0.0371
$COPYEXAM
Pr(1) Pr(2)
class 1: 0.6236 0.3764
class 2: 0.8181 0.1819
Estimated class population shares
0.1606 0.8394
Predicted class memberships (by modal posterior prob.)
0.1693 0.8307
=========================================================
Fit for 2 latent classes:
=========================================================
number of observations: 319
number of estimated parameters: 9
residual degrees of freedom: 6
maximum log-likelihood: -440.0271
AIC(2): 898.0542
BIC(2): 931.9409
G^2(2): 7.764242 (Likelihood ratio/deviance statistic)
X^2(2): 8.3234 (Chi-square goodness of fit)
Conditional item response (column) probabilities,
by outcome variable, for each class (row)
$LIEEXAM
Pr(1) Pr(2)
class 1: 0.4389 0.5611
class 2: 0.9903 0.0097
$LIEPAPER
Pr(1) Pr(2)
class 1: 0.4858 0.5142
class 2: 0.9647 0.0353
$FRAUD
Pr(1) Pr(2)
class 1: 0.7850 0.2150
class 2: 0.9655 0.0345
$COPYEXAM
Pr(1) Pr(2)
class 1: 0.5925 0.4075
class 2: 0.8257 0.1743
Estimated class population shares
0.1781 0.8219
Predicted class memberships (by modal posterior prob.)
0.1492 0.8508
=========================================================
Fit for 2 latent classes:
=========================================================
2 / 1
Coefficient Std. error t value Pr(>|t|)
(Intercept) -0.11342 0.50992 -0.222 0.833
GPA 0.84249 0.28132 2.995 0.030
=========================================================
number of observations: 315
number of estimated parameters: 10
residual degrees of freedom: 5
maximum log-likelihood: -429.6384
AIC(2): 879.2768
BIC(2): 916.8025
X^2(2): 8.641712 (Chi-square goodness of fit)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.