Calculating survival probabilities from Mortality tables in MATLAB

5 ビュー (過去 30 日間)
susman
susman 2020 年 8 月 14 日
コメント済み: susman 2020 年 8 月 17 日
I am working with mortality tables on MATLAB. My aim is to upload any (Mortality Table) data file in Matlab and calculate survival probabilities.
I tried to calibrate lifetable using MATLAB program [a,elx] = lifetablefit(x,lx). But I am not able to run the code. Matlab returns,
Unrecognized function or variable 'x'.
Error in lifetable (line 6) [a,elx] = lifetablefit(x,lx);
I have attached the datafile and I here is my code.
opts=detectImportOptions('lifetable2000CM.csv', 'PreserveVariableNames', true) % to locate table and return its import options
data = readtable('lifetable2000CM.csv',opts); % I have two variables "x" which is age and "lx" which is number of survivals at each age
[a,elx] = lifetablefit(x,lx);
MATLAB works perfectly fine if I write
load us_lifetable_2009
My aim is to to program any kind of lifetable in MATLAB. If anyone has experience in this area please help me out.

採用された回答

Tommy
Tommy 2020 年 8 月 14 日
readtable() returns a table which should contain your variables. Try
[a,elx] = lifetablefit(data.x, data.lx);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIndustrial Statistics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by