politenessProjection: Politeness projection

Description Usage Arguments Details Value Examples

View source: R/politenessProjection.R

Description

Training and projecting a regression model of politeness.

Usage

1
2
politenessProjection(df_polite_train, covar = NULL,
  df_polite_test = NULL, classifier = c("glmnet", "mnir"), ...)

Arguments

df_polite_train

a data.frame with politeness features as outputed by politeness used to train model.

covar

a vector of politeness labels, or other covariate.

df_polite_test

optional data.frame with politeness features as outputed by politeness used for out-of-sample fitting. Must have same feature set as polite_train (most easily acheived by setting dropblank=FALSE in both calls to politeness).

classifier

name of classification algorithm. Defaults to "glmnet" (see glmnet) but "mnir" (see mnlm) is also available.

...

additional parameters to be passed to the classification algorithm.

Details

List:

Value

List of df_polite_train and df_polite_test with projection. See details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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])

politeness documentation built on Oct. 30, 2018, 5:05 p.m.