politenessProjection {politeness} | R Documentation |
Politeness projection
Description
Training and projecting a regression model using politeness features.
Usage
politenessProjection(
df_polite_train,
covar = NULL,
df_polite_test = NULL,
classifier = c("glmnet", "mnir"),
cv_folds = NULL,
...
)
Arguments
df_polite_train |
a data.frame with politeness features as outputed by |
covar |
a vector of politeness labels, or other covariate. |
df_polite_test |
optional data.frame with politeness features as outputed by |
classifier |
name of classification algorithm. Defaults to "glmnet" (see |
cv_folds |
Number of outer folds for projection of training data. Default is NULL (i.e. no nested cross-validation). However, positive values are highly recommended (e.g. 10) for in-sample accuracy estimation. |
... |
additional parameters to be passed to the classification algorithm. |
Details
List:
train_proj projection of politeness model within training set.
test_proj projection of politeness model onto test set (i.e. out-of-sample).
train_coef coefficients from the trained model.
Value
List of df_polite_train and df_polite_test with projection. See details.
Examples
data("phone_offers")
data("bowl_offers")
polite.data<-politeness(phone_offers$message, parser="none",drop_blank=FALSE)
polite.holdout<-politeness(bowl_offers$message, parser="none",drop_blank=FALSE)
project<-politenessProjection(polite.data,
phone_offers$condition,
polite.holdout)
# Difference in average politeness across conditions in the new sample.
mean(project$test_proj[bowl_offers$condition==1])
mean(project$test_proj[bowl_offers$condition==0])