poLCA.table: Frequency tables of predicted cell counts from latent class...

Description Usage Arguments Details Value See Also Examples

View source: R/poLCA.table.R

Description

Calculates predicted cell frequencies based on an estimated latent class model.

Usage

1

Arguments

formula

A formula expression of the form variable ~ 1 for a one-way frequency distribution, or row ~ column for two way-tables.

condition

A list containing the values of the manifest variables to hold fixed when creating the table specified by the formula argument. Setting this to an empty list, condition=list(), conditions on none of the other manifest variables, producing the marginal frequencies.

lc

A model object previously estimated using the poLCA function.

Details

This function outputs predicted cell counts for user-specified combinations of the manifest variables, based on a latent class model estimated by the poLCA function. The predcell table outputted automatically by poLCA also contains predicted cell frequencies, but only for cells containing at least one observation. In contrast, poLCA.table will calculate predicted cell counts for all cells, including those with zero observations.

Value

A vector or table containing the specified frequency distribution.

See Also

poLCA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(gss82)
f <- cbind(PURPOSE,ACCURACY,UNDERSTA,COOPERAT)~1
gss.lc2 <- poLCA(f,gss82,nclass=2)
gss.lc2$predcell

poLCA.table(formula=COOPERAT~1,condition=list(PURPOSE=3,ACCURACY=1,UNDERSTA=2),lc=gss.lc2)

poLCA.table(formula=COOPERAT~UNDERSTA,condition=list(PURPOSE=3,ACCURACY=1),lc=gss.lc2)

poLCA.table(formula=COOPERAT~UNDERSTA,condition=list(),lc=gss.lc2)

Example output

Loading required package: scatterplot3d
Loading required package: MASS
Conditional item response (column) probabilities,
 by outcome variable, for each class (row) 
 
$PURPOSE
            Good Depends Waste of time
class 1:  0.2154  0.2066        0.5780
class 2:  0.8953  0.0579        0.0468

$ACCURACY
          Mostly true Not true
class 1:       0.0297   0.9703
class 2:       0.6367   0.3633

$UNDERSTA
            Good Fair/Poor
class 1:  0.7422    0.2578
class 2:  0.8327    0.1673

$COOPERAT
          Interested Cooperative Impatient
class 1:      0.6478      0.2498    0.1024
class 2:      0.8840      0.1043    0.0117

Estimated class population shares 
 0.1923 0.8077 
 
Predicted class memberships (by modal posterior prob.) 
 0.1864 0.8136 
 
========================================================= 
Fit for 2 latent classes: 
========================================================= 
number of observations: 1202 
number of estimated parameters: 13 
residual degrees of freedom: 22 
maximum log-likelihood: -2783.268 
 
AIC(2): 5592.536
BIC(2): 5658.729
G^2(2): 79.33723 (Likelihood ratio/deviance statistic) 
X^2(2): 93.25329 (Chi-square goodness of fit) 
 
   PURPOSE ACCURACY UNDERSTA COOPERAT observed expected
1        1        1        1        1      419  408.076
2        1        1        1        2       35   48.339
3        1        1        1        3        2    5.497
4        1        1        2        1       71   82.090
5        1        1        2        2       25    9.752
6        1        1        2        3        5    1.121
7        1        2        1        1      270  255.710
8        1        2        1        2       25   36.387
9        1        2        1        3        4    6.743
10       1        2        2        1       42   54.774
11       1        2        2        2       16    8.621
12       1        2        2        3        5    1.892
13       2        1        1        1       23   27.047
14       2        1        1        2        4    3.374
15       2        1        1        3        1    0.456
16       2        1        2        1        6    5.534
17       2        1        2        2        2    0.716
18       2        2        1        1       43   37.321
19       2        2        1        2        9   10.365
20       2        2        1        3        2    3.718
21       2        2        2        1        9   10.759
22       2        2        2        2        3    3.340
23       2        2        2        3        2    1.262
24       3        1        1        1       26   23.198
25       3        1        1        2        3    3.248
26       3        1        2        1        1    4.940
27       3        1        2        2        2    0.760
28       3        2        1        1       85   74.468
29       3        2        1        2       23   25.464
30       3        2        1        3        6   10.007
31       3        2        2        1       13   24.084
32       3        2        2        2       12    8.634
33       3        2        2        3        8    3.452
 Interested Cooperative Impatient
   4.940145   0.7603672 0.1613176
                  Good Fair/Poor
Interested  23.1977334 4.9401449
Cooperative  3.2481189 0.7603672
Impatient    0.5830969 0.1613176
                 Good  Fair/Poor
Interested  825.81927 182.180734
Cooperative 127.17641  31.823591
Impatient    27.00432   7.995676

poLCA documentation built on May 29, 2017, 5:59 p.m.

Search within the poLCA package
Search all R packages, documentation and source code