Calculates Freeman's theta for a table with one ordinal variable and one nominal variable; confidence intervals by bootstrap.
freemanTheta(
x,
g = NULL,
group = "row",
verbose = FALSE,
progress = FALSE,
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
digits = 3,
reportIncomplete = FALSE
)
Either a two-way table or a two-way matrix. Can also be a vector of observations of an ordinal variable.
If x
is a vector, g
is the vector of observations for
the grouping, nominal variable.
If x
is a table or matrix, group
indicates whether
the "row"
or the "column"
variable is
the nominal, grouping variable.
If TRUE
, prints statistics for each
comparison.
If TRUE
, prints a message as each comparison is
conducted.
If TRUE
, returns confidence intervals by bootstrap.
May be slow.
The level for the confidence interval.
The type of confidence interval to use.
Can be any of "norm
", "basic
",
"perc
", or "bca
".
Passed to boot.ci
.
The number of replications to use for bootstrap.
If TRUE
, produces a histogram of bootstrapped values.
The number of significant digits in the output.
If FALSE
(the default),
NA
will be reported in cases where there
are instances of the calculation of the statistic
failing during the bootstrap procedure.
A single statistic, Freeman's theta. Or a small data frame consisting of Freeman's theta, and the lower and upper confidence limits.
Freeman's coefficent of differentiation (theta) is used as a measure of association for a two-way table with one ordinal and one nominal variable. See Freeman (1965).
Currently, the function makes no provisions for NA
values in the data. It is recommended that NA
s be removed
beforehand.
Because theta is always positive, if type="perc"
,
the confidence interval will
never cross zero, and should not
be used for statistical inference.
However, if type="norm"
, the confidence interval
may cross zero.
When theta is close to 0 or very large, or with small counts in some cells, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
Freeman, L.C. 1965. Elementary Applied Statistics for Students in Behavioral Science. Wiley.
# NOT RUN {
data(Breakfast)
library(coin)
chisq_test(Breakfast, scores = list("Breakfast" = c(-2, -1, 0, 1, 2)))
freemanTheta(Breakfast)
### Example from Freeman (1965), Table 10.6
Counts = c(1,2,5,2,0,10,5,5,0,0,0,0,2,2,1,0,0,0,2,3)
Matrix = matrix(Counts, byrow=TRUE, ncol=5,
dimnames = list(Marital.status=c("Single","Married","Widowed",
"Divorced"),
Social.adjustment = c("5","4","3","2","1")))
Matrix
freemanTheta(Matrix)
### Example after Kruskal Wallis test
data(PoohPiglet)
kruskal.test(Likert ~ Speaker, data = PoohPiglet)
freemanTheta(x = PoohPiglet$Likert, g = PoohPiglet$Speaker)
### Same data, as table of counts
data(PoohPiglet)
XT = xtabs( ~ Speaker + Likert , data = PoohPiglet)
freemanTheta(XT)
# }
Run the code above in your browser using DataLab