{smcl} {* First Version August 15 2026}{...} {* This Version August 15 2026}{...} {viewerdialog ages "dialog ages"}{...} {viewerjumpto "Syntax" "ages##syntax"}{...} {viewerjumpto "Stored results" "ages##results"}{...} {viewerjumpto "Examples" "ages##Examples"}{...} {hline} Help for {hi:ages} {hline} {title:Description} {p}{cmd:ages} estimates the relationship between population age-cohorts shares and a dependent variable of choice, based on the polynomial transformation suggested by {helpb ages##references:Fair and Dominguez (1991)} and applied later by Higgins (1998), Arnott and Chaves (2012) and {helpb ages##references:Juselius and Takats (2018,2021)}. {p_end} {p}Capturing the effects of changes in the population's age structure in a regression involves different methodological issues, such as weak precision if the number of population cohorts is large compared with the number of time periods, large correlation between consecutive cohorts' shares and perfect collinearity with respect to the constant. The solution consists of restricting the age groups coefficients to lie on a Pth degree polynomial and restricting its sum to be equal to zero to remove the perfect multicolinearity. {p_end} {p}{cmd:ages} performs all the necessary transformations and mathematical calculations to estimate and report the final effect by age-cohort, together with its standard error and confidence interval, as an output matrix and through an automated graph that displays the effect of all the age-cohorts on the dependent variable. It allows testing for different age structure effects based on different groups captured by an interaction with a dummy variable. {p_end} {p}It also allows estimating a fully dynamic model with lags of the age-cohorts, or their polynomial transformation terms, included in the specification. {cmd:ages} allows the user to define the desired number of lags of the age-cohorts and then reports the age structure effect as a sum of the contemporaneus and lagged coefficients. Alternatively, it can also report each age-cohort effect lag by lag.{p_end} {p}The user can easily choose different options for the graph with the impact by age group, as well as several other options to save and use the results.{p_end} {p}{cmd:ages} allows the user to choose different estimation methods for both time series and panel data.{p_end} {synoptline} {marker index}{...} {title:Index} {synopt :{helpb ages##syntax:Syntax}} Syntax{p_end} {synopt :{helpb ages##options:Options}}{p_end} {synopt :{helpb ages##required:Required Options}} Defining the age-cohorts variables and its transformation {p_end} {synopt :{helpb ages##specification:Specification Options}} Options defining the specification of the age-cohorts.{p_end} {synopt :{helpb ages##estimation:Estimation Method}} Estimation Method options {p_end} {synopt :{helpb ages##output:Displaying and Saving Results}} Options for displaying and saving the estimation outputs.{p_end} {synopt :{helpb ages##graph_options:Graph Options}} Options for modifying the IRF graph{p_end} {synopt :{helpb ages##results:Stored results}}{p_end} {synopt :{helpb ages##Examples:Examples}}{p_end} {synopt :{helpb ages##example1:Example 1}} Defining the basic specification options{p_end} {synopt :{helpb ages##example2:Example 2}} Changing the estimation method and adding methodological options {p_end} {synopt :{helpb ages##example3:Example 3}} Adding lags to the age-structure (steps) {p_end} {synopt :{helpb ages##example4:Example 4}} Displaying the full regression output{p_end} {synopt :{helpb ages##example5:Example 5}} Changing the confidence level or using more than one level{p_end} {synopt :{helpb ages##example6:Example 6}} Saving the results into new variables{p_end} {synopt :{helpb ages##example7:Example 7}} Options for plotting the coefficients {p_end} {synopt :{helpb ages##example8:Example 8}} Interaction of the age-structure with a dummy variable{p_end} {synoptline} {marker syntax}{...} {title:Syntax} {p 8 13 2} {cmd:ages} {depvar} [{it:controls}] {ifin} {cmd:,} {opt *v:arname(string)} {opt *g:roups(string)} {opt *np(integer)} [{opt lagpol(integer)} {opt inter(string)} {opt bylag} {opt f:act(real)} {opt conf(numlist integer)} {opt noi:sily} {it:model_options} {opt save:ages(string)} {opt nograph} {opt z:ero} {opt ti:tle(string)} {opt lab:el(string)} {opt lcol:or(string)} {opt tti:tle(string)} {opt grn:ame(string)} {opt grs:ave(string)} {opt as(string)} {opt gro:pt(string)} ]{p_end} {synoptline} {synoptset 33 tabbed}{...} {marker options}{...} {synopthdr:Options} {synoptline} {marker required}{...} {syntab:{bf:Required Options:}} {synopt:{opt v:arname(string)}}Specifies the common string part of the name of the variables that represent the age-cohorts. Different age-cohorts variables have to be specified with a variable name that consists of two parts, one string that is common to all of the groups and one part specific to each group. In this option you need to specify the part that is common to all the groups. For instance, if you have three groups and your variables are named {it: coh_young}, {it: coh_middle} and {it: coh_old}, then in this option you would need to introduce the common part "coh_" as {opt varname(coh_)}. If the variables are named {it: gr1_share}, {it: gr2_share} and {it: g3_share} you would need to introduce two strings "gr" and "_share" as {opt varname(gr _share)}.{p_end} {synopt:{opt g:roups(string)}}Specifies the specific parts of the variables' names that represent each one of the {bf:K} age-cohorts, which could be strings, numbers, or any combination of them. Different age-cohorts variables have to be specified with a variable name that consists of two parts, one common to all the groups and one specific to each group. In this option you need to specify the part that is specific to each group. For instance, if you have three groups and your variables are named {it: coh_young}, {it: coh_middle} and {it: coh_old}, then in this option you would need to introduce the strings "young middle old" as {opt groups(young middle old)}. If the variables are named {it: gr1_share, gr2_share and g3_share} you would need to introduce the numbers "1 2 3" as {opt groups(1 2 3)}.{p_end} {synopt:{opt np(integer)}}Specifies the degree {bf: P} of the polynomial transformation, with {bf: P