renamed res_ij to resi

This commit is contained in:
2025-05-28 16:01:58 +02:00
parent 3d537eccd8
commit 3da6ad689c
6 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@ export(iptw)
export(pcbm) export(pcbm)
export(pcbsm) export(pcbsm)
export(pcm) export(pcm)
export(res_ij) export(resi)
export(residif) export(residif)
export(select_weight) export(select_weight)
import(PP) import(PP)

View File

@ -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") { } else if (method.theta=="mle") {
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1] 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 colnames(resid) <- items_o
##### Output ##### Output

View File

@ -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") { } else if (method.theta=="mle") {
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1] 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 colnames(resid) <- items_o
##### Output ##### Output

View File

@ -274,7 +274,7 @@ pcm <- function(df=NULL,items=NULL,grp=NULL,dif.items=NULL,type.dif=NULL,weights
} else if (method.theta=="mle") { } else if (method.theta=="mle") {
theta <- PP::PP_gpcm(as.matrix(df[,items]),t(restab),rep(1,length(items)),type="mle")$resPP$resPP[,1] 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 colnames(resid) <- items_o
##### Output ##### Output

View File

@ -1,4 +1,4 @@
## File Name: res_ij.R ## File Name: resi.R
## File version: 1.0 ## File version: 1.0
#' Compute rasch person-item residuals #' Compute rasch person-item residuals
@ -14,7 +14,7 @@
#' @import vcrpart #' @import vcrpart
#' @export #' @export
res_ij <- function(thetahat_i,delta_hat_j,res,beta=0){ resi <- function(thetahat_i,delta_hat_j,res,beta=0){
var=0 var=0
denomin=1 denomin=1
for (i in 1:length(delta_hat_j)) { for (i in 1:length(delta_hat_j)) {

View File

@ -1,10 +1,10 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/res_ij.R % Please edit documentation in R/resi.R
\name{res_ij} \name{resi}
\alias{res_ij} \alias{resi}
\title{Compute rasch person-item residuals} \title{Compute rasch person-item residuals}
\usage{ \usage{
res_ij(thetahat_i, delta_hat_j, res, beta = 0) resi(thetahat_i, delta_hat_j, res, beta = 0)
} }
\arguments{ \arguments{
\item{thetahat_i}{Person parameter estimate for person i} \item{thetahat_i}{Person parameter estimate for person i}