Learn R Programming

cacIRT (version 1.0)

Rud.P: Rudner's approach with the P methods

Description

Called by class.Rud to compute marginal indices with P method

Usage

Rud.P(cutscore, os, sem)

Arguments

cutscore
os
sem

Value

    Examples

    Run this code
    ##---- Should be DIRECTLY executable !! ----
    ##-- ==>  Define data, use random,
    ##--	or do  help(data=index)  for the standard data sets.
    
    ## The function is currently defined as
    function(cutscore, os, sem) 
    	 { 
    	 	nn<-length(os)
    	 	
    	 	if(nn != length(sem)) stop("Ability and se of different length")
    	
    		esacc<-matrix(NA,length(cutscore), nn, dimnames = list(paste("cut at",cutscore), round(os,3)))
    		escon <-esacc
    		for(j in 1:length(cutscore)){
    			cuts<-c(-Inf, cutscore[j], Inf)		 	
    	 		categ<-cut(os,cuts,labels=F,right=F)
    			
    		for(i in 1:nn) {
    			esacc[j,i]<-(pnorm(cuts[categ[i]+1],os[i],sem[i])-pnorm(cuts[categ[i]],os[i],sem[i]))
    			escon[j,i]<-((pnorm(cuts[2], os[i],sem[i]) - pnorm(cuts[1],os[i],sem[i]))^2	+ (pnorm(cuts[3], os[i],sem[i]) - pnorm(cuts[2],os[i],sem[i]))^2	 )
    			}}
    		
    		ans<- (list("Marginal" = cbind("Accuracy" = rowMeans(esacc), "Consistency" = rowMeans(escon)), "Conditional" = list("Accuracy" =t(esacc), "Consistency" = t(escon))))
    				
    			
    			#print(list("Marinal Accuracy" = round(rowMeans(esacc),4), "Marginal Consistency"=round(rowMeans(escon),4)))
     
     ans
    	}

    Run the code above in your browser using DataLab