## sbm
## setting
seed = 2
n = 100
theta.in = 0.03
theta.bw = 0.001
K = 2
A = gen.sbm(n, theta.in, theta.bw, K, seed)
# you can try the following to get separate results
# fit.A = fpca.nonscore(A, maxsteps = 100, tol = 1e-3, normalised = TRUE, K = 2,
# ridge = FALSE, approx = TRUE)
#A.cluster = fpca.nonscore.cluster(fit.A$final.whole)
#A.cut = fpca.cut(A, fit.A, A.cluster)
#get.cluster(A, fit.A$iso.seq, A.cut, A.cluster)
# in fpca.start function, only the matrix/array of the fused loadings estimators
# are get. no further estimation are calculated.
#fit.start.A = fpca.start(A, maxsteps = 100, tol = 1e-3, normalised = TRUE, K = 2,
# ridge = TRUE, approx = TRUE)
fit.A.wrapup = fpca(A, maxsteps = 200, tol = 1e-3, normalised = TRUE, K = 2,
ridge = FALSE, approx = TRUE)
## you can also try the following example
### degree-corrected block model
# seed = 2
# K = 2
# n = 100
# theta.in = 0.03
# theta.bw = 0.001
# theta = rep(0, n*K)
# for(i in 1:(n*K)){
# theta[i] = 0.75 + 0.475*(i/n/K)
# }
# A = gen.dcbm(n = n, theta.in = theta.in, theta.bw = theta.bw, theta = theta, K = 2,
# seed = seed)
# you can try the following to get separate results
# fit.A = fpca.score(A, maxsteps = 200, tol = 1e-3, K = 2, ridge = FALSE,
# approx = TRUE)
# in fpca.start function, only the matrix/array of the fused loadings estimators
# are get. no further estimation are calculated.
#fit.start.A = fpca.start(A, maxsteps = 100, tol = 1e-3, normalised = TRUE, K = 2,
#ridge = TRUE, approx = TRUE, score = TRUE)
# fit.A.wrapup = fpca(A, maxsteps = 200, tol = 1e-3, normalised = TRUE, K = 2,
# ridge = FALSE, approx = FALSE, score = TRUE)
Run the code above in your browser using DataLab