pfake | R Documentation |
The function gives the conditional probability of replacement p(f=k|d=h,θ_F) for discrete values in the range 1, …, Q.
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"))
k |
A fake value. |
h |
An observed original value. |
p |
Overall probability of replacement: |
Q |
Max value in the discrete r.v. range: 1, …, Q. |
gam |
Gamma parameter: |
del |
Delta parameter: |
fake.model |
A character string
indicating the model for the conditional replacement distribution. The options are: |
Gives the conditional probability distribution based on the following equation
p(f=k|d=h,θ_F)= ≤ft\{ \begin{array}{cl} DG(k;h+1,Q,γ_{+},δ_{+}) π_{+} & 1 ≤q h < k ≤q Q \\ DG(k;q,h-1,γ_{-},δ_{-}) π_{-} & 1 ≤q k < h ≤q Q \\ 1-(π_{+}+π{-}) & 1 < h=k < Q \\ 1- π_{+} & k=h=1 \\ 1- π_{-} & k=h=Q \end{array} \right.
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=h-1). The parameter π_{+} denotes the probability of faking good, π_{-} indicates the probability of faking bad.
Note that the faking probabilities must satisfy the following condition: π_{+}+π_{-} ≤q 1.
Massimiliano Pastore & Luigi Lombardi
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.
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") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.