50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


sgr (version 1.3.1)

pfake: Probability of faking.

Description

The function gives the conditional probability of replacement p(f=k|d=h,θF) for discrete values in the range 1,,Q.

Usage

pfake(k, h = k, p = c(0,0), Q = 5, gam = c(1,1), del = c(1,1),
      fake.model = c("uninformative", "average", "slight", "extreme"))

Arguments

k

A fake value.

h

An observed original value.

p

Overall probability of replacement: p[1] indicates the faking good probability, p[2] indicates the faking bad probability.

Q

Max value in the discrete r.v. range: 1,,Q.

gam

Gamma parameter: gam[,1] indicates the faking good parameter γ+, gam[,2] indicates the faking bad parameter γ.

del

Delta parameter: del[,1] indicates the faking good parameter δ+, del[,2] indicates the faking bad parameter δ.

fake.model

A character string indicating the model for the conditional replacement distribution. The options are: uninformative (default option) [gam = c(1,1) and del = c(1,1)]; average [gam = c(3,3) and del = c(3,3)]; slight [gam = c(1.5,4) and del = c(4,1.5)]; extreme [gam = c(4,1.5) and del = c(1.5,4)].

Value

Gives the conditional probability distribution based on the following equation p(f=k|d=h,θF)={DG(k;h+1,Q,γ+,δ+)π+1h<kQDG(k;q,h1,γ,δ)π1k<hQ1(π++π)1<h=k<Q1π+k=h=11πk=h=Q with θF and DG being the parameter vector (γ+,γ,δ+,δ,π+,π) and the generalized Beta distribution for discrete variables (dgBetaD) with bounds a=h+1 (resp. a=1) and b=Q (resp b=h1). The parameter π+ denotes the probability of faking good, π indicates the probability of faking bad. Note that the faking probabilities must satisfy the following condition: π++π1.

References

Lombardi, L., Pastore, M. (2014). sgr: A Package for Simulating Conditional Fake Ordinal Data. The R Journal, 6, 164-177.

Pastore, M., Lombardi, L. (2014). The impact of faking on Cronbach's Alpha for dichotomous and ordered rating scores. Quality & Quantity, 48, 1191-1211.

Examples

Run this code
# NOT RUN {
x <- 1:7
GA <- c(1,3,1.5,8); DE <- c(1,3,4,2.5)

### fake good
par(mfrow=c(2,2))
for (j in 1:4) {
  y <- NULL
  for (i in x) y <- c(y,pfake(x[i],h=4,Q=7,
                gam=c(GA[j],GA[j]),del=c(DE[j],DE[j]),p=c(.4,0)))
  plot(x,y,type="h",panel.first=points(x,y,pch=19),
       main=paste("gamma=",GA[j]," delta=",DE[j],sep=""),ylim=c(0,.7),
       ylab="Replacement probability") 
}

### fake bad
for (j in 1:4) {
  y <- NULL
  for (i in x) y <- c(y,pfake(x[i],h=4,Q=7,
                gam=c(GA[j],GA[j]),del=c(DE[j],DE[j]),p=c(0,.4)))
  plot(x,y,type="h",panel.first=points(x,y,pch=19),
       main=paste("gamma=",GA[j]," delta=",DE[j],sep=""),ylim=c(0,.7),
       ylab="Replacement probability") 
}

### fake good and fake bad
P = c(.4,.4)
par(mfrow=c(2,4))
for (j in x) {
  y <- NULL
  for (i in x) {
    y <- c(y,pfake(x[i],h=x[j],Q=max(x),gam=c(GA[1],GA[1]),del=c(DE[1],DE[1]),p=P))
  }
  plot(x,y,type="h",panel.first=points(x,y,pch=19),
       main=paste("h=",x[j],sep=""),ylim=c(0,1),
       ylab="Replacement probability") 
  print(sum(y,na.rm=TRUE)) 
}

### using the fake.model argument
x <- 1:5 
models <- c("uninformative","average","slight","extreme")
par(mfrow=c(2,2))
for (j in 1:4) {
  y <- NULL
  for (i in x) y <- c(y,pfake(x[i],h=2,Q=max(x),
            fake.model=models[j],p=c(.45,0)))       # fake good
  plot(x,y,type="h",panel.first=points(x,y,pch=19),
       main=paste(models[j],"model"),ylim=c(0,1),
       ylab="Replacement probability") 
}

par(mfrow=c(2,2))
for (j in 1:4) {
  y <- NULL
  for (i in x) y <- c(y,pfake(x[i],h=4,Q=max(x),
            fake.model=models[j],p=c(0,.45)))       # fake bad
  plot(x,y,type="h",panel.first=points(x,y,pch=19),
       main=paste(models[j],"model"),ylim=c(0,1),
       ylab="Replacement probability") 
}

# }

Run the code above in your browser using DataLab