[R] Equivalence test and factors

Tobah Gass tgass at uidaho.edu
Mon Apr 17 22:29:16 CEST 2006


Hello, helpeRs,

I recently used a linear mixed effects model followed by ANOVA to 
assess the relationship between a categorical predictor variable with 2 
levels (and random effects) and a numeric response variable.  As I was 
concerned about the lack of a power analysis prior to data collection, 
it was suggested that I use an equivalence test to complement the 
conventional hypothesis test.  Using "equiv.boot" in 
package "equivalence", I get an "NA" response for the test of the 
intercept ($rs.b0 and $Test.b0) and the following warnings after the 
last line of output:

Warning messages: 
1: argument is not numeric or logical: returning NA in: mean.default(x, 
na.rm = TRUE) 
2: argument is not numeric or logical: returning NA in: mean.default(x, 
na.rm = TRUE)

"equiv.p" produced the following:

Error in lm.fit(x, y, offset = offset, singular.ok = 
singular.ok, ...) : 
        0 (non-NA) cases
In addition: Warning messages: 
1: argument is not numeric or logical: returning NA in: mean.default(x, 
na.rm = TRUE) 
2: "-" not meaningful for factors in: Ops.factor(x, mean(x, na.rm = 
TRUE)) 

I received the same warnings and errors using the simple simulation:

low <- rnorm(50, 100, 25)
high <- rnorm(50, 300, 75)
ages = c(low,high)
levels = 1:100
levels[1:50] = "L"
levels[51:100] = "H"
test = data.frame(ages, levels)
class(test$levels)
equiv.boot(test$levels, test$ages)
equiv.p(test$levels, test$ages)

Can the equivalence package, or parts thereof, handle categorical 
predictor variables of 2 or more levels?  Can the package, or the 
package plus another function, be used to test the similarity of the 
predictions produced by two or more factor levels from nested or 
otherwise correlated data?  Which of the equivalence functions 
accomodates unbalanced designs?  Using functions such as tost.data to 
compare observations associated with the 2 predictors in my data is 
complicated both by the unbalanced design and the lack of accomodation 
of the nested design.

Note that I am running R 2.0.1 which predates the version in 
which "equivalence" was developed.

Thank you in advance.

Toby




More information about the R-help mailing list