Instrumental Variable Regression and Probit Regression

Goodmorning,
I need help to create my instrumental varibale.
i am investigating the causal relationship between education and fertility of senegalese women in 2019. i need to create a variable (IV) which represents the mean of the years of schooling of the respondent's household memebers . however i have to select only the members older than the respodent, because their educational level can impact the educational level of the respondent.

in my dataframe I have the years of education of each member and the line number of the respondent. I have to select only the member before the line number of the respondent and i need to create a function.

##compute average years of schooling of the household members - older than the respondent ( 1st instrumental variable )
H <- household[ , c( 927 : 985)] #select the columns with the years of education of all the household
however i need to compute the mean of a different number of columns for each row and the number should be < of the line number of the respondent ( older household members) .

should I transform all the numbers contained in columns after the respondent column in NA and then compute the mean? but how?

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.