Coder Social home page Coder Social logo

seonghobae / kaefa Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 92.24 MB

# kaefa kwangwoon automated exploratory factor analysis for improving research capability to identify unexplained factor structure with complexly cross-classified multilevel structured data in R environment

License: Other

R 100.00%
mirt automated-analysis automated-reasoning automated-machine-learning factor-analysis exploratory-data-analysis exploratory-factor-analysis multilevel-models model-selection exploratory-ifa

kaefa's People

Contributors

seonghobae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kaefa's Issues

Add start time information

Add start time information in actual results

kaefa/R/kaefa.R

Line 400 in da6bf9d

TimeStart <- Sys.time()

kaefa/R/kaefa.R

Lines 867 to 877 in da6bf9d

TimeEnd <- Sys.time()
TimeTotal <- TimeEnd - TimeStart
if (saveModelHistory) {
class(modelHistory) <- "aefa"
modelHistory$TimeTotal <- TimeTotal
return(modelHistory)
} else {
return(estModel)
}

Modify the random effect variable set criteria

Citation

Lee, W.-Y., Cho, S.-J., & Sterba, S. K. (2018). Ignoring a Multilevel Structure in Mixture Item Response Models: Impact on Parameter Recovery and Model Selection. Applied Psychological Measurement, 42(2), 136–154. http://doi.org/10.1177/0146621617711999

"Based on these findings, it is concluded that, for class-specific ICC conditions examined here, a multilevel mixture item response model is recommended over a single- level item response model for a clustered dataset having cluster size >20 and the number of clusters >50." (from abstract, p. 136)

Where to fix

https://github.com/seonghobae/kaefa/blob/master/R/utils.R#L59-L75

How to fix

  • Add the code if cluster size < 20, exclude the variable from random effect term.

add shiny environment

click-by-click interface for applied psychologists

Most applied psychologists are want to easy method to do their research with robust measurement theories. However, they feel hard to use the software. They do not have any experience with making their codes.

Add ‘pickGlobalOptimal’ function

pickGlobalOptimal

In current, most aefa related functions are returning the list of possible appropriate solutions. However that’s too hard to select optimal model to general users like applied psychologists. So that I will make a function what calls ‘pickGlobalOptimal’, person can set the criterion indices like the DIC, AIC, BIC, SABIC. As the default, I’ll set the DIC.

Detect remote cluster OS via SSH

seongho@onmyway:~$ cat /etc/os-release | grep NAME
NAME="Ubuntu"
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
[root@s3 ~]# cat /etc/os-release | grep NAME
NAME="CentOS Linux"
PRETTY_NAME="CentOS Linux 7 (Core)"
CPE_NAME="cpe:/o:centos:centos:7"

Maybe, system('cat /etc/os-release | grep NAME') helps do this.

Support the auto combination of numeric variables

Details

kaefa/R/utils.R

Lines 3 to 68 in da6bf9d

.covdataClassifieder <- function(a){
if(!is.null(a)){
if(sum(class(a) %in% "tbl_df") != 0){
a <- as.data.frame(a)
}
# marking integers: NEED TO FIX
markInt <- vector()
for(i in 1:ncol(a)){
if(is.integer(a[,i])){
markInt[length(markInt) + 1] <- i
} else {
}
}
# change as factor
for(i in 1:ncol(a)){
a[,i] <- as.factor(a[,i])
}
# classify fixed and random
fixedVars <- vector()
randomVars <- vector()
for(i in 1:ncol(a)){
if(length(levels(a[,i])) <= 30){
fixedVars <- c(fixedVars, i)
} else {
randomVars <- c(randomVars, i)
}
}
# test group size to move random
if(length(fixedVars) != 0){
gotoRandom <- vector()
for(i in 1:ncol(a)){
if(max(table(a[,i]))/min(table(a[,i])) < 2){
} else {
gotoRandom[length(gotoRandom) + 1] <- i
}
}
if(length(randomVars) != 0){
fixedVars <- fixedVars[!fixedVars %in% gotoRandom]
randomVars <- c(randomVars, gotoRandom)
}
}
# elemenate random vars if group size under 2
if(length(randomVars)){
excludeRandomVars <- vector()
for(i in randomVars){
if(min(table(a[,i])) > 1){
} else {
excludeRandomVars <- c(excludeRandomVars, i)
}
}
randomVars <- randomVars[!randomVars %in% excludeRandomVars]
}
list(fixed = colnames(a[unique(fixedVars)]), random = colnames(a[unique(randomVars)]))
} else {
list(fixed = NULL, random = NULL)
}
}

In current, kaefa:::.covdataFixedEffectComb returns a list which includes the classified categorical variable candidates for fixed and random effect.

So, In currently, Support the auto combination of numeric variables required.

Especially, L9 to L16 was incomplete.

kaefa/R/utils.R

Lines 9 to 16 in da6bf9d

# marking integers: NEED TO FIX
markInt <- vector()
for(i in 1:ncol(a)){
if(is.integer(a[,i])){
markInt[length(markInt) + 1] <- i
} else {
}
}

Todo

  • Check is that a unique numeric variable which one of the covariance data frame.

  • Add return outcomes which one is real numeric variable (ex. age). -- If False Positive, That doesn't matter in estimation. Because that's just a trial, not harm.

  • Link with combination function in internal.

    kaefa/R/newEngine.R

    Lines 75 to 85 in da6bf9d

    combine <- function(x, y) {
    combn(y, x, paste, collapse = ", ")
    }
    if (ranefautocomb) {
    randomEffectCandidates <- paste0("list(", unlist(lapply(0:NROW(random), combine,
    random)), ")")
    } else {
    randomEffectCandidates <- paste0("list(", unlist(lapply(NROW(random):NROW(random),
    combine, random)), ")")
    }

    kaefa/R/kaefa.R

    Line 383 in da6bf9d

    BURNIN = 1500, SEMCYCLES = 1000, covdata = NULL, fixed = kaefa:::.covdataFixedEffectComb(covdata), random = lapply(c(kaefa:::.covdataClassifieder(covdata)$random, 'items'), FUN = function(X){eval(parse(text = paste0('as.formula(',paste0('~1|',X), ')')))}), key = NULL, accelerate = "squarem", symmetric = F, saveModelHistory = T,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.