# Get paths to toy data files
# This file has two constraints
data_file_small <- system.file(
"extdata", "sample_data_frame.csv", package = "maxent.ot"
)
# This file has three constraints
data_file_large <- system.file(
"extdata", "sample_data_frame_large.csv", package = "maxent.ot"
)
# Fit weights to both data sets with no biases
tableaux_small <- read.csv(data_file_small)
small_model <- optimize_weights(tableaux_small)
tableaux_large <- read.csv(data_file_large)
large_model <- optimize_weights(tableaux_large)
# Compare models using likelihood ratio test. This is appropriate here
# because the constraints are nested.
compare_models(small_model, large_model, method='lrt')
# Compare models using AIC
compare_models(small_model, large_model, method='aic')
# Compare models using AICc
compare_models(small_model, large_model, method='aic_c')
# Compare models using BIC
compare_models(small_model, large_model, method='bic')
Run the code above in your browser using DataLab