Description Usage Arguments Details Value Author(s) See Also Examples

Classifies new observations using the parameters determined by
the `lcda`

-function.

1 2 |

`object` |
Object of class |

`newdata` |
Data frame of cases to be classified. |

`...` |
Further arguments are ignored. |

Posterior probabilities for new observations using parameters determined by
the `lcda`

-function are computed. The classification of the new data is done by the Bayes decision function.

A list with components:

`class` |
Vector (of class |

`posterior` |
Posterior probabilities for the classes.
For details of computation see |

Michael B\"ucker

`lcda`

, `cclcda`

, `predict.cclcda`

, `cclcda2`

, `predict.cclcda2`

, `poLCA`

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 38 39 40 41 42 | ```
# response probabilites for class 1
probs1 <- list()
probs1[[1]] <- matrix(c(0.7,0.1,0.1,0.1,0.1,0.7,0.1,0.1),
nrow=2, byrow=TRUE)
probs1[[2]] <- matrix(c(0.1,0.7,0.1,0.1,0.1,0.1,0.7,0.1),
nrow=2, byrow=TRUE)
probs1[[3]] <- matrix(c(0.1,0.1,0.7,0.1,0.1,0.1,0.1,0.7),
nrow=2, byrow=TRUE)
probs1[[4]] <- matrix(c(0.1,0.1,0.1,0.7,0.7,0.1,0.1,0.1),
nrow=2, byrow=TRUE)
# response probabilites for class 2
probs2 <- list()
probs2[[1]] <- matrix(c(0.1,0.1,0.7,0.1,0.1,0.1,0.1,0.7),
nrow=2, byrow=TRUE)
probs2[[2]] <- matrix(c(0.1,0.1,0.1,0.7,0.7,0.1,0.1,0.1),
nrow=2, byrow=TRUE)
probs2[[3]] <- matrix(c(0.7,0.1,0.1,0.1,0.1,0.7,0.1,0.1),
nrow=2, byrow=TRUE)
probs2[[4]] <- matrix(c(0.1,0.7,0.1,0.1,0.1,0.1,0.7,0.1),
nrow=2, byrow=TRUE)
# generation of data
simdata1 <- poLCA.simdata(N = 500, probs = probs1, nclass = 2,
ndv = 4, nresp = 4, missval = FALSE)
simdata2 <- poLCA.simdata(N = 500, probs = probs2, nclass = 2,
ndv = 4, nresp = 4, missval = FALSE)
data1 <- simdata1$dat
data2 <- simdata2$dat
data <- cbind(rbind(data1, data2), rep(c(1,2), each=500))
names(data)[5] <- "grouping"
data <- data[sample(1:1000),]
grouping <- data[[5]]
data <- data[,1:4]
# lcda-procedure
object <- lcda(data, grouping=grouping, m=2)
pred.class <- predict(object, newdata=data)$class
sum(pred.class==grouping)/length(pred.class)
``` |

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.