statistics - What is this error in R? -



statistics - What is this error in R? -

i have 2 variables: decsorgs2 , regionfactor (which factored "region")

freq(decsorgs2) decsorgs2 frequency percent 0 disagree 365 53.76 1 agree 314 46.24 total 679 100.00 freq(regionfactor) regionfactor frequency percent 1 12 1.767 2 82 12.077 3 128 18.851 4 64 9.426 5 138 20.324 6 43 6.333 7 53 7.806 8 57 8.395 9 102 15.022 total 679 100.000

i'm trying anova aov().

aov(decsorgs2~regionfactor) error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : na/nan/inf in 'y' in addition: warning message: in model.response(mf, "numeric") : nas introduced coercion

what error? don't understand of these terms. thanks

edit: ok, did hail-mary random effort , recoded decsorgs2.

initially had:

decsorgs2 = recode(decsorgs, "4:5='0 disagree'; 1:2='1 agree'")

now used:

decsorgs2 = recode(decsorgs, "4:5=0; 1:2=1")

it seemed work. why? why decsorgs2 have numerical, if purpose of factoring variable part create read categorical? how know 1 has numerical , categorical?

aov needs continuous response variable. passing character variable , coerced numeric:

y <- c("0 disagree", "1 agree") as.numeric(y) #[1] na na #warning message: #nas introduced coercion y <- c("0", "1") as.numeric(y) #[1] 0 1

you need reconsider statistical methodology.

r statistics stat code-statistics

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -