Comments (7)
Please provide reproducible script and data.
from sirt.
hi, I upload the data as Rdata in this zip file. (Sample Size is 5000 and Test Length is 20)
dat.zip
And the script is
P_PGenlogis <- function( par, Theta, ncat){
a <- par[1]
b <- par[2]
talpha1 <- par[3]
talpha2 <- par[4]
TP <- nrow(Theta)
P <- matrix( NA, nrow=TP, ncol=ncat)
P[,2] <- sirt::pgenlogis((a*(Theta[,1]- b)), alpha1=(exp(2*talpha1)-1)/(exp(2*talpha1)+1), alpha2=(exp(2*talpha2)-1)/(exp(2*talpha2)+1))
P[,1] <- 1 - P[,2]
return(P)
}
par <- c("a" = 1, "b" = 0, "talpha1" = 0, "talpha2" = 0)
item_1PGenlogis <- xxirt_createDiscItem( name = "1PGenlogis" , par = par, est = c(FALSE,TRUE,TRUE,TRUE), P = P_PGenlogis)
item_2PGenlogis <- xxirt_createDiscItem( name = "2PGenlogis" , par = par, est = c(TRUE,TRUE,TRUE,TRUE), P = P_PGenlogis)
customItems <- list(item_1PGenlogis, item_2PGenlogis)
mod.2PGenlogis.estimate <- function(dat, j){
itemtype = rep( "2PGenlogis", j)
partable = xxirt_createParTable(dat, itemtype = itemtype, customItems = customItems)
parindex1 <- partable[ partable$parname=="talpha1","parindex"]
parindex2 <- partable[ partable$parname=="talpha2","parindex"]
lambda <- 1
penalty_fun_item <- function(x){
val <- (sum(sapply(x[parindex1], "-", x[parindex1])^2) + sum(sapply(x[parindex2], "-", x[parindex2])^2)) * lambda
return(val)
}
smod2.2PGenlogis <- xxirt( dat=dat, Theta=Theta, partable=partable, maxit=3000, customItems=customItems, customTheta=customTheta, conv = 0.001, penalty_fun_item=penalty_fun_item, verbose = F)
return(smod2.2PGenlogis)
}
Theta <- matrix( seq(-6,6,len=61) , ncol=1 )
P_Theta1 <- function( par , Theta , G){
mu <- par[1]
sigma <- max( par[2] , .01 )
TP <- nrow(Theta)
pi_Theta <- matrix( 0 , nrow=TP , ncol=G)
pi1 <- dnorm( Theta[,1] , mean = mu , sd = sigma )
pi1 <- pi1 / sum(pi1)
pi_Theta[,1] <- pi1
return(pi_Theta)
}
par_Theta <- c( "mu"=0, "sigma" = 1 )
customTheta <- xxirt_createThetaDistribution( par=par_Theta , est=c(F,T), P=P_Theta1 )
set.seed(2)
mod.2PGenlogis <- mod.2PGenlogis.estimate(dat = dat, j = 20)
And when I estimated this data without regularized estimation, same error shows.
mod.2PGenlogis.estimate <- function(dat, j){
itemtype = rep( "2PGenlogis", j)
partable = xxirt_createParTable(dat, itemtype = itemtype, customItems = customItems)
smod1.2PGenlogis <- xxirt( dat=dat, Theta=Theta, partable=partable, maxit=10000, customItems=customItems, customTheta=customTheta, conv = 0.001, verbose = T)
return(smod1.2PGenlogis)
}
from sirt.
A slightly more condensed script would be more helpful in order to focus on the primary issue. I do want to dive into your mod.2PGenlogis.estimate
function. Could you please ensure that the dimensions of itemtype
and dat
are properly chosen?
from sirt.
This data is simulated using the generation process of the second simulation study mentioned in the atricle [An Alternative to the 3PL: Using Asymmetric Item Characteristic Curves to Address Guessing Effects - Lee - 2018 - Journal of Educational Measurement - Wiley Online Library](https://onlinelibrary.wiley.com/doi/10.1111/jedm.12165), expect that I rearrange item order from easier to moer difficult. According to this generation process, I think it might be some multidimensional problem.(This estimation focuses on unidimensional and dichotomous item) The generation model from this article is :
And I followed your excellent work in [Information | Free Full-Text | Regularized Generalized Logistic Item Response Model (mdpi.com)](https://www.mdpi.com/2078-2489/14/6/306) with fisher transformation as: (hope I didn't get these wrong)
alpha1=(exp(2*talpha1)-1)/(exp(2*talpha1)+1), alpha2=(exp(2*talpha2)-1)/(exp(2*talpha2)+1)
and regularized estimation with lambda = 1
as:
partable = xxirt_createParTable(dat, itemtype = itemtype, customItems = customItems)
parindex1 <- partable[ partable$parname=="talpha1","parindex"]
parindex2 <- partable[ partable$parname=="talpha2","parindex"]
lambda <- 1
penalty_fun_item <- function(x){
val <- (sum(sapply(x[parindex1], "-", x[parindex1])^2) + sum(sapply(x[parindex2], "-", x[parindex2])^2)) * lambda
return(val)
}
The full simulation script is quite long and comments are kind of messy to read, so I have to appolzise to take some time to tidy it. I will send it as soon as I finish organize the comments. But all the script lines involving the mod.2PGenlogis.estimate
function are posted.
Thank you!
from sirt.
I played a bit with script and data. I strongly recommend using lower and upper bounds for talpha1
and talpha2
(e.g., -4 and 4).
from sirt.
It finally works! And adding lower and upper bounds doesn't cost much extra time to converge.
Thank you so much for your responsiveness and time!
from sirt.
As an alternative, one can prevent numerical overflow in the inverse Fisher transformation (exp(2*talpha)-1)/(exp(2*talpha)+1)
. This formula can be safely used for talpha <= 0
. For talpha > 0
, one can compute (1-exp(-2*talpha)-1)/(1+exp(-2*talpha))
.
from sirt.
Related Issues (20)
- MCMC for 2-factor MIRT/Ising HOT 1
- issues with multidimensional rasch.mirtlc and "MLC2" HOT 1
- Documentation around ccov.np HOT 5
- Rasch infit mnsq error?
- DETECT outcomes are inconsistent with the original DETECT software HOT 5
- DETECT Exploratory analysis HOT 2
- DETECT explaratory procedure `nclusters` argument HOT 7
- lavaan2mirt unexpectedly estimates a covariance matrix
- availability of `regpolca` HOT 1
- bug: cfa_meas_inv() returns incorrect mod_pi lavaan-object (not so for mod_mi) HOT 1
- using btm function with eps = 0 returns error HOT 4
- Calculations of scores - Example 2 - conf.detect() HOT 2
- comparing rasch.jml to winsteps HOT 1
- gamma.testlet HOT 1
- comparing rasch.jml to winsteps part 2 HOT 3
- rasch.jml. itemdiff.correction incorrect when using constraints HOT 1
- modifying mcmc.3pno.testlet to make it 3pl model HOT 1
- lsem.estimate(): Error on missing data in moderator HOT 3
- TIBBLES ARE NO DATA FRAMES | lsem.estimate(): error when input is tibble data frame HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sirt.