I have a very large dataset consisting of car insurance policyholders (C) and those who died in a car accident (D). The dataset includes different rate types (what type of insurance was in place). I want to do a logistic regression as a function of age. Is there a way to find an optimal regression equation?
for example now i have something like this in R
glm( cbind(D, C-D)~d_regr+1, data=data, family=binomial)
where d_regr is something like age, (age^2), (age^3)/3 and so on.
is there a nice way to find an optimal function, only depending on the variable age - for example with maximizing the pseudo R^2 or so?