ccrs: Correcting and Clustering response style biased data

Description Usage Arguments Value References See Also Examples

View source: R/ccrs.R

Description

Applies CCRS to ccrsdata.list.

Usage

1
2
ccrs(ccrsdata.list,K=K,lam=lam, tandem.initial=FALSE,
            tol = 1e-5, maxit = 50, trace = 1, nstart = 3, parallel=F,verbose=T)

Arguments

ccrsdata.list

A list generated by create.ccrsdata.

K

An integer indicating the number of content-based clusters used for CCRS estimation.

lam

A numeric value indicating lambda used for CCRS estimation.

tandem.initial

A logical value indicating whether the 1st initial value is generated by CCRS tandem initialization. See Section 3.3 in the paper for the detail.

tol

A numeric value indicating the absolute convergence tolerance

maxit

An integer indicating the maximum number of iterations

trace

An non-negative integer. If positive, tracing information on the progress of the optimization is produced. Higher values produce more tracing information.

nstart

An integer indicating the number of random initial values.

parallel

A logical value indicating parallelization over starts is used.

verbose

A logical value indicaitng if the progress is printed during the iteration (only when parallel==FALSE).

Value

Returns a list with the following elements.

G

A K by m matrix of content-based cluster centroid.

cls.cont.vec

A vector of integers (from 1:K) indicating the content-based cluster to which each respondent is allocated.

opt.obval

An optimal value of objective function.

crs.list

A list of class crs, same as the one generated by correct.rs.

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

correct.rs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
###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
ccrsdata.list <- create.ccrsdata(X,q=q)
###CCRS
lam <- 0.8 ; K <- 2
ccrs.list <- ccrs(ccrsdata.list,K=K,lam=lam)
###check content-based clustering result
ccrs.list$cls.cont.vec
###check correction result
plot(ccrs.list$crs.list)

Example output

K= 2 , lam= 0.8 
Start     1 Iter     1 Loss 10.33153832 Diff 0.000000000000 
Start     1 Iter     1 Loss 3.92538726 Diff -6.406151059187 
Start     1 Iter     1 Loss 3.43033532 Diff -0.495051940166 
Start     1 Iter     2 Loss 3.24241254 Diff -0.187922779968 
Start     1 Iter     2 Loss 2.53208910 Diff -0.710323441159 
Start     1 Iter     2 Loss 2.49216804 Diff -0.039921052403 
Start     1 Iter     3 Loss 2.39175318 Diff -0.100414859230 
Start     1 Iter     3 Loss 2.35300677 Diff -0.038746410477 
Start     1 Iter     3 Loss 2.35300677 Diff 0.000000000000 
  converged at 2 th iteration.
Start     2 Iter     1 Loss 8.64242455 Diff 0.000000000000 
Start     2 Iter     1 Loss 4.12602045 Diff -4.516404102193 
Start     2 Iter     1 Loss 4.03333933 Diff -0.092681111614 
Start     2 Iter     2 Loss 3.77215658 Diff -0.261182753255 
Start     2 Iter     2 Loss 3.30966236 Diff -0.462494222181 
Start     2 Iter     2 Loss 2.80199768 Diff -0.507664675458 
Start     2 Iter     3 Loss 2.72944546 Diff -0.072552219303 
Start     2 Iter     3 Loss 2.38853319 Diff -0.340912275938 
Start     2 Iter     3 Loss 2.38853319 Diff 0.000000000000 
  converged at 2 th iteration.
Start     3 Iter     1 Loss 7.99775202 Diff 0.000000000000 
Start     3 Iter     1 Loss 4.01867735 Diff -3.979074673120 
Start     3 Iter     1 Loss 3.77275256 Diff -0.245924783786 
Start     3 Iter     2 Loss 3.53187555 Diff -0.240877015906 
Start     3 Iter     2 Loss 2.82010861 Diff -0.711766940801 
Start     3 Iter     2 Loss 2.59458559 Diff -0.225523021175 
Start     3 Iter     3 Loss 2.50836980 Diff -0.086215785887 
Start     3 Iter     3 Loss 2.36248258 Diff -0.145887222080 
Start     3 Iter     3 Loss 2.36248258 Diff 0.000000000000 
  converged at 2 th iteration.
Warning message:
`as_data_frame()` is deprecated as of tibble 2.0.0.
Please use `as_tibble()` instead.
The signature and semantics have changed, see `?as_tibble`.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
 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 
 2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1  2  1 
27 28 29 30 
 2  1  2  1 

ccrs documentation built on May 1, 2019, 10:11 p.m.