renamed res_ij to resi
This commit is contained in:
2
R/pcbm.R
2
R/pcbm.R
@ -238,7 +238,7 @@ pcbm <- function(df=NULL,items=NULL,grp=NULL,X=NULL,dif.items=NULL,type.dif=NULL
|
||||
} else if (method.theta=="mle") {
|
||||
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1]
|
||||
}
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) res_ij(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) resi(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
colnames(resid) <- items_o
|
||||
|
||||
##### Output
|
||||
|
@ -250,7 +250,7 @@ pcbsm <- function(df=NULL,items=NULL,grp=NULL,u=NULL,X=NULL,dif.items=NULL,type.
|
||||
} else if (method.theta=="mle") {
|
||||
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1]
|
||||
}
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) res_ij(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) resi(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
colnames(resid) <- items_o
|
||||
|
||||
##### Output
|
||||
|
2
R/pcm.R
2
R/pcm.R
@ -274,7 +274,7 @@ pcm <- function(df=NULL,items=NULL,grp=NULL,dif.items=NULL,type.dif=NULL,weights
|
||||
} else if (method.theta=="mle") {
|
||||
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1]
|
||||
}
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) res_ij(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
resid <- apply(matrix(1:nbitems,ncol=length(nbitems)),1, function(k) sapply(1:nrow(df), function(j) resi(theta[j],restab[k,],df[j,items[k]],beta=0)))
|
||||
colnames(resid) <- items_o
|
||||
|
||||
##### Output
|
||||
|
@ -1,4 +1,4 @@
|
||||
## File Name: res_ij.R
|
||||
## File Name: resi.R
|
||||
## File version: 1.0
|
||||
|
||||
#' Compute rasch person-item residuals
|
||||
@ -14,7 +14,7 @@
|
||||
#' @import vcrpart
|
||||
#' @export
|
||||
|
||||
res_ij <- function(thetahat_i,delta_hat_j,res,beta=0){
|
||||
resi <- function(thetahat_i,delta_hat_j,res,beta=0){
|
||||
var=0
|
||||
denomin=1
|
||||
for (i in 1:length(delta_hat_j)) {
|
Reference in New Issue
Block a user