I would like to calculate the AICs (Akaike's information criterion) to find out which one is more appropriate for different restricted cubic spline with different numbers of knots.
Does anyone know how to calculate the AICs?

Thank you for your cooperation.

The followings are sample commands.

Code:
capture ssc install postrcspline

sysuse uslifeexp, clear

mkspline2 ys = year, cubic nknots(3)
des ys*
reg le ys*

adjustrcspline, ///
addplot(scatter le year, msymbol(Oh)) ///
ytitle("life expectancy (knots3)")
graph export rcsknots3.tif, as(tif) replace

capture drop ys*
mkspline2 ys = year, cubic nknots(5)
des ys*
reg le ys*

adjustrcspline, ///
addplot(scatter le year, msymbol(Oh)) ///
ytitle("life expectancy (knots5)")
graph export rcsknots5.tif, as(tif) replace