generate.rsdata {ccrs}R Documentation

Simulate preference data to apply CCRS

Description

Simulates artificial preference data containing content-based (and response-style-based) clusters.

Usage

generate.rsdata(n=n,m=m,q=q,K.true=K.true,H.true=NULL,clustered.rs=FALSE,
              cls.cont.vec=NULL,cls.rs.vec=NULL,savedata=FALSE)

Arguments

n

An integer indicating the number of respondents.

m

An integer indicating the number of items.

q

An integer indicating the maximum rating.

K.true

An integer indicating the true number of content-based clusters for n respondents.

H.true

An integer indicating the true number of response-style-based clusters for n respondents. This is needed when clustered.rs=TRUE.

clustered.rs

A logical value indicating whether response-style-based cluster structure exists in generated data. If TRUE, coefficients of I-spline are generated by response-style-based clusters. The default is clustered.rs=FALSE.

cls.cont.vec

A vector of integers (from 1:K.true) of length n indicating the content-based cluster to which each respondent is allocated in artificial data. If it's NULL, it is generated automatically.

cls.rs.vec

A vector of integers (from 1:H.true) of length n indicating the response-style-based clusters. If it's NULL and clustered.rs==T, it is generated randomly.

savedata

A logical value indicating whether artificial data are saved as csv files. The default is savedata=FALSE.

Value

A list with the following elements:

X

An n by m matrix of categorical variables.

X.star

An n by m matrix of true preference data X^*.

X.nors

An n by m matrix of categorical variables transformed by reference boundaries.

cls.cont.vec

A vector of integers (from 1:H.true) indicating content-based clusters used to generate artificial data.

cls.rs.vec

A vector of integers (from 1:H.true) indicating response-style-based clusters used to generate artificial data.

References

Takagishi, M., Velden, M. van de & Yadohisa, H. (2019). Clustering preference data in the presence of response style bias, to appear in British Journal of Mathematical and Statistical Psychology.

See Also

create.ccrsdata

Examples

#data setting
n <- 30 ; m <- 10 ; H.true <- 2 ; K.true <- 2 ; q <- 5
datagene <- generate.rsdata(n=n,m=m,K.true=K.true,H.true=H.true,q=q,clustered.rs = TRUE)
#obtain n x m data matrix
X <- datagene$X

[Package ccrs version 0.1.0 Index]