Description Usage Arguments Value Note Author(s) References See Also Examples
sparse factor analysis to extract latent linear factor and estimate row-sparse and entry-wise-sparse loading matrix.
1 |
X |
a |
q |
an integer between 1 and |
lambda1 |
a non-negative number, the row-sparse penalty parameter, default as |
lambda2 |
a non-negative number, the entry-sparse penalty parameter, default as |
return a list with class named fac
, including following components:
hH |
a |
sphB |
a |
hB |
a |
q |
an integer between 1 and |
propvar |
a positive number between 0 and 1, the explained propotion of cummulative variance by the |
egvalues |
a n-dimensional(n<=p) or p-dimensional(p<n) vector, the eigenvalues of sample covariance matrix. |
nothing
Liu Wei
Wei Liu, Huazhen Lin, Jin Liu (2020). Estimation and inference on high-dimensional sparse factor models.
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 | dat <- gendata(n = 300, p = 500)
res <- gsspFactorm(dat$X)
ccorFun(res$hH, dat$H0) # the smallest canonical correlation
## comparison of l2 norm
par(mar=c(5,5,2,2), mfrow=c(1,2))
plot(rowSums(dat$B0^2), type='o', ylab='l2B', main='True')
l2B <- rowSums(res$sphB^2)
plot(l2B, type='o', main='Est.')
Bind <- ifelse(dat$B0==0, 0, 1)
hBind <- ifelse(res$sphB==0, 0, 1)
## structure of loading matrix
image(x=1:nrow(Bind), y= 1:ncol(Bind), z=Bind , col = 1:3,#hcl.colors(12, "YlOrRd",rev=F),
ylab='columns', xlab='rows',cex.lab=1.8, cex.axis=1.6 )
image(x=1:nrow(Bind), y= 1:ncol(Bind), z=hBind , col = 1:3,#hcl.colors(12, "YlOrRd",rev=F),
ylab='columns', xlab='rows',cex.lab=1.8, cex.axis=1.6 )
## Select good penalty parameters
dat <- gendata(n = 300, p = 200)
res <- gsspFactorm(dat$X, lambda1=0.04*nrow(dat$X)^(1/4) ,lambda2=1*nrow(dat$X)^(1/4))
ccorFun(res$hH, dat$H0) # the smallest canonical correlation
## comparison of l2 norm
plot(rowSums(dat$B0^2), type='o', ylab='l2B', main='True')
l2B <- rowSums(res$sphB^2)
plot(l2B, type='o', main='Est.')
## comparison of structure of loading matrix
Bind <- ifelse(dat$B0==0, 0, 1)
hBind <- ifelse(res$sphB==0, 0, 1)
image(x=1:nrow(Bind), y= 1:ncol(Bind), z=Bind , col = 1:3,#hcl.colors(12, "YlOrRd",rev=F),
ylab='columns', xlab='rows',cex.lab=1.8, cex.axis=1.6, main='True')
image(x=1:nrow(Bind), y= 1:ncol(Bind), z=hBind , col = 1:3,#hcl.colors(12, "YlOrRd",rev=F),
ylab='columns', xlab='rows',cex.lab=1.8, cex.axis=1.6, main='Est.' )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.