We can't manage to generate a Leontief Inverse matrix, below an example.

Given for example the following matrix converted from stata.

A=st_data(.,("a", "b","c", "d", "e","f"))

1 2 3 4 5 6

+-------------------------------+

1 | 8 4 5 2 3 1 |

2 | 9 5 5 5 9 9 |

3 | 9 3 3 3 5 6 |

4 | 3 10 8 8 6 10 |

5 | 6 1 4 5 9 10 |

6 | 4 7 3 3 5 3 |

+-------------------------------+

We try to generate a Leontief Inverse matrix by typing:

B = colsum(A)

C = luinv(diag(B))

D = A*C

L = luinv(I(6) - D)

L

we obtain

1 2 3 4 5 6

+-------------------------+

1 | . |

2 | . . |

3 | . . . |

4 | . . . . |

5 | . . . . . |

6 | . . . . . . |

+-------------------------+

Could someone suggest the right code to build a Leontief Inverse Matrix?

Thank you very much