# gendat: Data generation In plfm: Probabilistic Latent Feature Analysis

## Description

Computation of association probabilities and data generation for disjunctive, conjunctive or additive probabilistic latent feature models.

## Usage

 `1` ```gendat(maprule="disj", N, objpar, attpar) ```

## Arguments

 `maprule` Disjunctive (`maprule="disj"`), conjunctive (`maprule="conj"`) or additive (`maprule="add"`) mapping rule of the probabilistic latent feature model. `N` Number of replications for which binary associations are generated. `objpar` True objectparameters. As object parameters are probabilities they should be between 0 and 1. `attpar` True attributeparameters. As attribute parameters are probabilities they should be between 0 and 1.

## Details

The function `gendat` computes for all pairs of J objects and K attributes association probabilities and it generates association frequencies (i.e. the number of replications `N` for which an object is associated to an attribute), according to a disjunctive, conjunctive or additive probabilistic latent feature model. In addition, the function computes a matrix with in each cell the total number of replications `N`. If the requested number of replications `N` equals 0, the function only computes association probabilities and does not generate new data.

To compute association probabilities the function gendat uses a J X F matrix of object parameters and a K X F matrix of attribute parameters as input. The F object parameters of object j represent, for each of F features, the probability that object j has feature f. Similarly, the F attribute parameters of attribute k reflect, for each of F features, the probability that attribute k is linked to feature f.

According to the disjunctive probabilistic latent feature model, object j is associated to attribute k if the object and the attribute have at least one feature in common. More specifically, the association probability in cell (j,k) for the disjunctive model can be computed as:

p(j,k)=1-∏_f(1-objpar[j,f]*attpar[k,f]).

According to the conjunctive probabilistic latent feature model, object j and attribute k are associated if object j has all the features that are linked to attribute k. For the conjunctive model the association probability in cell (j,k) is computed as:

p(j,k)=∏_f(1-(1-objpar[j,f])*attpar[k,f]).

The additive mapping rule states that an object and attribute are more likely to associated if they have more common features. More specifically, the association probability for the additive model is computed as

p(j,k)= (1/F) * ∑_f (objpar[j,f])*attpar[k,f])

## Value

 `call` Parameters used to call the function. `prob1` J X K matrix of association probabilities. `freq1` J X K matrix of association frequencies. `freqtot` J X K matrix with number of replications.

Michel Meulders

## References

Maris, E., De Boeck, P., and Van Mechelen, I. (1996). Probability matrix decomposition models. Psychometrika, 61, 7-29.

Meulders, M., De Boeck, P., Van Mechelen, I., Gelman, A., and Maris, E. (2001). Bayesian inference with probability matrix decomposition models. Journal of Educational and Behavioral Statistics, 26, 153-179.

Meulders, M., De Boeck, P., Van Mechelen, I., & Gelman, A. (2005). Probabilistic feature analysis of facial perception of emotions. Applied Statistics, 54, 781-793.

`plfm`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```## define constants J<-20 K<-15 F<-2 ## generate true parameters set.seed(43565) objectparameters<-matrix(runif(J*F),nrow=J) attributeparameters<-matrix(runif(K*F),nrow=K) ## compute association probabilities for a conjunctive model probconj<-gendat(maprule="conj",N=0, objpar=objectparameters,attpar=attributeparameters) ## generate data for a disjunctive model using N=200 replications gdat<-gendat(maprule="disj",N=200, objpar=objectparameters,attpar=attributeparameters) ## generate data for a additive model using N=200 replications gdat<-gendat(maprule="add",N=200, objpar=objectparameters,attpar=attributeparameters) ```