dexter-psychometrics / dexter

Management, assessment, and psychometric analysis of data from educational and psychological tests
GNU Lesser General Public License v3.0
8 stars 5 forks source link

How to discard NA in DIF? #4

Closed frankbach closed 2 years ago

frankbach commented 2 years ago

get_persons(keht21) %>% glimpse()

Rows: 533 Columns: 3 $ person_id "Ht21hossna01", "Ht21hossna02", "Ht21hossna03", "Ht21hossna05", "Ht21hossna06", "Ht21hossna07", "Ht21hossna0… $ gender "f", "p", "f", "f", "p", "p", "p", "f", "p", "f", "f", "p", NA, "f", "p", "f", "f", "p", "f", "p", "p", "f",… $ sva NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "ja", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…

How to deal with NA's in the gender column in DIF? Best Frank

jessekps commented 2 years ago

short answer:

dd = DIF(db, person_property="gender", predicate = !is.na(gender))
plot(dd)

You can use predicates in every analysis function in dexter, they work similar to R subset or dplyr filter statements.

If you use a database, I would also recommend using specific missing value codes, rather than NA's.