Title: | Data Analysis with Ceiling and/or Floor Data |
---|---|
Description: | An implementation of data analytic methods in R for analyses for data with ceiling/floor effects. The package currently includes functions for mean/variance estimation and mean comparison tests. Implemented methods are from Aitkin (1964) <doi:10.1007/BF02289723> and Liu & Wang (in prep). |
Authors: | Qimin Liu [aut, cre], Lijuan Wang [aut] |
Maintainer: | Qimin Liu <[email protected]> |
License: | GPL-2 |
Version: | 1.0.0 |
Built: | 2025-02-28 05:17:07 UTC |
Source: | https://github.com/cran/DACF |
conduct a Brown-Forsythe F star test
f.star.test(means, variances, ns)
f.star.test(means, variances, ns)
means |
a (non-empty) numeric vector of the group means |
variances |
a (non-empty) numeric vector of the group variances |
ns |
a (non-empty) numeric vector of sample sizes per group |
statistic |
the value of the adjusted Brown-Forsythe F star statistic |
p.value |
the p-value for the test |
est.f.squared |
effect size estimate as in Cohen's f squared |
# a f star test for three-group mean comparison f.star.test(c(-.2,0,.2),c(1,1,1),c(100,100,100)) f.star.test(c(0,0,1),c(2,1,3),c(100,100,100))
# a f star test for three-group mean comparison f.star.test(c(-.2,0,.2),c(1,1,1),c(100,100,100)) f.star.test(c(0,0,1),c(2,1,3),c(100,100,100))
inducing ceiling/floor effects in data
induce.cfe(floor.perc, ceiling.perc, y)
induce.cfe(floor.perc, ceiling.perc, y)
floor.perc |
a (non-empty) numeric value from 0 to 1 denoting the desired percentage of floor effects |
ceiling.perc |
a (non-empty) numeric value from 0 to 1 denoting the desired percentage of ceiling effects |
y |
a (non-empty) numeric vector of data |
y scores with induced ceiling/floor effects
x=rnorm(1000,0,1) #simulate "healthy data" x.c20=induce.cfe(0,.2,x) #induce 20% ceiling effects into the data sum(x.c20==max(x.c20))/length(x.c20) #check ceiling percentage x.f20=induce.cfe(.2,0,x) #induce 20% floor effects into the data sum(x.f20==min(x.f20))/length(x.f20) #check ceiling percentage
x=rnorm(1000,0,1) #simulate "healthy data" x.c20=induce.cfe(0,.2,x) #induce 20% ceiling effects into the data sum(x.c20==max(x.c20))/length(x.c20) #check ceiling percentage x.f20=induce.cfe(.2,0,x) #induce 20% floor effects into the data sum(x.f20==min(x.f20))/length(x.f20) #check ceiling percentage
conduct an F star with for data with ceiling/floor effects
lw.f.star(data, formula, method_type)
lw.f.star(data, formula, method_type)
data |
a dataframe of data with ceiling/floor effects and corresponding group variables in wide format |
formula |
a formula denoting the dependent and independent variable, e.g., y~group |
method_type |
a character string specifying the preferred method type. "a" uses the original sample size and "b" uses after-truncation sample size. |
statistic |
the value of the Brown-Forsythe F star statistics |
p.value |
the p-value for the test |
est.f.squared |
effect size estimate in Cohen's f squared |
dat=threeganova.sim(1000,.16,1) dat[dat$group==1,3]=induce.cfe(0,.15,dat[dat$group==1,3]) lw.f.star(dat,y~group,"a") #using truncated n lw.f.star(dat,y~group,"b") #using original n
dat=threeganova.sim(1000,.16,1) dat[dat$group==1,3]=induce.cfe(0,.15,dat[dat$group==1,3]) lw.f.star(dat,y~group,"a") #using truncated n lw.f.star(dat,y~group,"b") #using original n
conduct a t test adjusting for ceiling and/or floor effects
lw.t.test(x1, x2, method_type)
lw.t.test(x1, x2, method_type)
x1 |
a (non-empty) numeric vector of data values for group 1 with floor/ceiling effects |
x2 |
a (non-empty) numeric vector of data values for group 2 with floor/ceiling effects |
method_type |
a character string specifying the preferred method type. "a" uses the original sample size and "b" uses after-truncation sample size. |
statistic |
the value of the adjusted t test statistics |
p.value |
the p-value for the test |
est.d |
effect size estimate as in Cohen's d |
conf.int |
95% confidence interval |
x1.c=induce.cfe(0,.3,rnorm(1000,20,5)) #group 1 scores with 30% ceiling data x2.c=induce.cfe(.15,0,rnorm(1000,30,5)) #group 2 scores with 15% floor data lw.t.test(x1.c,x2.c,"a") #using truncated n lw.t.test(x1.c,x2.c,"b") #using original n
x1.c=induce.cfe(0,.3,rnorm(1000,20,5)) #group 1 scores with 30% ceiling data x2.c=induce.cfe(.15,0,rnorm(1000,30,5)) #group 2 scores with 15% floor data lw.t.test(x1.c,x2.c,"a") #using truncated n lw.t.test(x1.c,x2.c,"b") #using original n
recover mean and variance of the data with ceiling/floor effects
rec.mean.var(y)
rec.mean.var(y)
y |
a (non-empty) numeric vector of data with ceiling/floor effects |
ceiling.percentage |
the percentage of ceiling values in the data |
floor.percentage |
the percentage of floor values in the data |
est.mean |
estimated mean of the true scores |
est.var |
estimated variance of the true scores |
# simulate normally distributed true scores x=rnorm(1000,2,4) mean(x); var(x) # induce 20% floor effects # and estimate the true mean variance from the floor data x.f=induce.cfe(.2,0,x) rec.mean.var(x.f) # induce 20% ceiling effects # and estimate the true mean and variance from the ceiling data x.c=induce.cfe(0,.2,x) rec.mean.var(x.c) # induce 20% and 10% of floor and ceiling effects, respectively # and estimate the true mean and variance from the data with floor and ceiling effects x.cf=induce.cfe(.2,.1,x) rec.mean.var(x.cf)
# simulate normally distributed true scores x=rnorm(1000,2,4) mean(x); var(x) # induce 20% floor effects # and estimate the true mean variance from the floor data x.f=induce.cfe(.2,0,x) rec.mean.var(x.f) # induce 20% ceiling effects # and estimate the true mean and variance from the ceiling data x.c=induce.cfe(0,.2,x) rec.mean.var(x.c) # induce 20% and 10% of floor and ceiling effects, respectively # and estimate the true mean and variance from the data with floor and ceiling effects x.cf=induce.cfe(.2,.1,x) rec.mean.var(x.cf)
simulate three-group anova data
threeganova.sim(group_n, f_sqr, sd.1)
threeganova.sim(group_n, f_sqr, sd.1)
group_n |
a (non-empty) numeric value of desired sample size per group |
f_sqr |
a (non-empty) numeric value of desired Cohen's f squared value |
sd.1 |
a (non-empty) numeric value of desired standard deviation ratio |
a dataframe containing scores "y", grouping factor "group", and residual errors.
sample.3g=threeganova.sim(1000,.16,5) #data of n=1000, sd1=sd3=1 and sd2=5, and f^2=.16 colnames(sample.3g) #examine the column names dim(sample.3g) #examine the data structure aggregate(sample.3g$y,sd,by=list(sample.3g$group)) #check group standard deviations
sample.3g=threeganova.sim(1000,.16,5) #data of n=1000, sd1=sd3=1 and sd2=5, and f^2=.16 colnames(sample.3g) #examine the column names dim(sample.3g) #examine the data structure aggregate(sample.3g$y,sd,by=list(sample.3g$group)) #check group standard deviations