I understand that there is a function in R called poly()
that can generate orthogonal polynomials--useful for applying on input variables before running a predictive model.
My question is that what is the role of categorical variables when we generate polynomials? Are they to be excluded?
Update:
Dan, Thank you for your kind response. I'm not sure I understand it completely - let me explain the query in more detail. I'm trying to run logistic regression using glmnet on Titanic dataset.
Let us assume shortened set of columns:
- * class(factor with three levels 1, 2 ,3),
* sex(factor: male, female),
* Age (integer),
*survived(factor & target variable 0 or 1).
I've seen examples with numeric input variables, where one can pass the entire input set to the poly() function and get polynomial features as output.
Your response is highly appreciated.