Description Usage Arguments Value Examples
View source: R/comparison_model.R
This function creates a regression model using a single numeric variable as a predictor, and a specified variable as the outcome. It is intended for comparison against models that use language as a predictor (created by language_model
).
1 | comparison_model(input, outcome, outcomeType, predictor, progressBar = TRUE)
|
input |
A dataframe containing a column with predictor data (numeric variable) and an outcome variable (numeric or two-level factor) |
outcome |
A string consisting of the column name for the outcome variable in |
outcomeType |
A string consisting of the type of outcome variable being used - options are "binary" or "continuous" |
predictor |
A string consisting of the column name for the predictor data in |
progressBar |
Show a progress bar. Defaults to TRUE. |
An object of the type "compModel"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
movie_review_data1$cleanText = clean_text(movie_review_data1$text)
# Using language to predict "Positive" vs. "Negative" reviews
movie_model_valence_language = language_model(movie_review_data1,
outcome = "valence",
outcomeType = "binary",
text = "cleanText")
summary(movie_model_valence_language)
# Is it possible that people write more for negative reviews?
# How does that compare to the language predictors?
movie_review_data1$word_count = corpus(movie_model_data1$cleanText) %>% tokens() %>% ntoken()
# Using word count to predict "Positive" vs. "Negative" reviews
movie_model_valence_wordcount = comparison_model(movie_review_data1,
outcome = "valence",
outcomeType = "binary",
predictor = "word_count")
summary(movie_model_valence_wordcount)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.