constructing a multilevel regression with random effects

1 visualización (últimos 30 días)
antonet
antonet el 27 de Sept. de 2012
Dear all,
I have
A={
type_of_loan rates country number_of observat number_of_loans number_of_brands num_of_regions
[ 50] [59.4676] [1] [ 1] [1] [1] [1]
[ 50] [60.5912] [1] [ 2] [2] [1] [1]
[ 50] [60.6639] [1] [ 3] [3] [1] [1]
[150] [18.0268] [1] [ 4] [1] [2] [1]
[ 40] [71.5121] [1] [ 5] [2] [2] [1]
[150] [18.0490] [1] [ 6] [3] [2] [1]
[150] [24.8137] [1] [ 7] [1] [3] [1]
[150] [14.4040] [1] [ 8] [2] [3] [1]
[150] [24.5367] [1] [ 9] [3] [3] [1]
[150] [13.7685] [1] [10] [1] [4] [1]
[150] [13.8424] [1] [11] [2] [4] [1]
[150] [43.5706] [1] [12] [3] [4] [1]
[ 50] [62.1655] [1] [13] [1] [1] [2]
[ 50] [62.5669] [1] [14] [2] [1] [2]
[ 50] [62.8517] [1] [15] [3] [1] [2]
[150] [16.8333] [1] [16] [1] [2] [2]
[ 40] [68.6505] [1] [17] [2] [2] [2]
[150] [16.7442] [1] [18] [3] [2] [2]
[150] [22.9361] [1] [19] [1] [3] [2]
[150] [13.4317] [1] [20] [2] [3] [2]
[150] [22.7204] [1] [21] [3] [3] [2]
[150] [13.3108] [1] [22] [1] [4] [2]
[150] [13.3286] [1] [23] [2] [4] [2]
[150] [41.3907] [1] [24] [3] [4] [2]
[ 50] [61.5225] [1] [25] [1] [1] [3]
[ 50] [62.3809] [1] [26] [2] [1] [3]
[ 50] [62.5472] [1] [27] [3] [1] [3]
[150] [18.3575] [1] [28] [1] [2] [3]
[ 40] [71.6378] [1] [29] [2] [2] [3]
[150] [18.2007] [1] [30] [3] [2] [3]
[150] [23.9379] [1] [31] [1] [3] [3]
[150] [13.4733] [1] [32] [2] [3] [3]
[150] [23.7831] [1] [33] [3] [3] [3]
[150] [13.6555] [1] [34] [1] [4] [3]
[150] [13.5768] [1] [35] [2] [4] [3]
[150] [41.7986] [1] [36] [3] [4] [3]
[ 50] [58.8043] [1] [37] [1] [1] [4]
[ 50] [59.8979] [1] [38] [2] [1] [4]
[ 50] [60.1406] [1] [39] [3] [1] [4]
[150] [19.4341] [1] [40] [1] [2] [4]
[ 40] [72.7402] [1] [41] [2] [2] [4]
[150] [18.5913] [1] [42] [3] [2] [4]
[150] [25.3780] [1] [43] [1] [3] [4]
[150] [14.3916] [1] [44] [2] [3] [4]
[150] [25.0602] [1] [45] [3] [3] [4]
[150] [13.9212] [1] [46] [1] [4] [4]
[150] [13.8527] [1] [47] [2] [4] [4]
[150] [44.4282] [1] [48] [3] [4] [4]
[ 50] [66.3466] [1] [49] [1] [1] [5]
[ 50] [69.3246] [1] [50] [2] [1] [5]
[ 50] [63.7933] [1] [51] [3] [1] [5]
[150] [19.4466] [1] [52] [1] [2] [5]
[ 40] [48.1944] [1] [53] [2] [2] [5]
[150] [18.6439] [1] [54] [3] [2] [5]
[150] [27.5151] [1] [55] [1] [3] [5]
[150] [13.6534] [1] [56] [2] [3] [5]
[150] [27.5469] [1] [57] [3] [3] [5]
[150] [15.8198] [1] [58] [1] [4] [5]
[150] [15.1235] [1] [59] [2] [4] [5]
[150] [49.0785] [1] [60] [3] [4] [5]
[ 50] [59.6975] [1] [61] [1] [1] [6]
[ 50] [60.4081] [1] [62] [2] [1] [6]
[ 50] [60.7452] [1] [63] [3] [1] [6]
[150] [19.5396] [1] [64] [1] [2] [6]
[ 40] [75.3618] [1] [65] [2] [2] [6]
[150] [18.5875] [1] [66] [3] [2] [6]
[150] [25.9974] [1] [67] [1] [3] [6]
[150] [14.7011] [1] [68] [2] [3] [6]
[150] [25.9541] [1] [69] [3] [3] [6]
[150] [13.9805] [1] [70] [1] [4] [6]
[150] [14.3128] [1] [71] [2] [4] [6]
[150] [44.9720] [1] [72] [3] [4] [6]
[ 50] [60.2959] [1] [73] [1] [1] [7]
[ 50] [60.8045] [1] [74] [2] [1] [7]
[ 50] [60.9119] [1] [75] [3] [1] [7]
[150] [19.1844] [1] [76] [1] [2] [7]
[ 40] [71.7604] [1] [77] [2] [2] [7]
[150] [19.0658] [1] [78] [3] [2] [7]
[150] [26.1284] [1] [79] [1] [3] [7]
[150] [15.2403] [1] [80] [2] [3] [7]
[150] [25.9214] [1] [81] [3] [3] [7]
[150] [13.5574] [1] [82] [1] [4] [7]
[150] [13.5555] [1] [83] [2] [4] [7]
[150] [40.9040] [1] [84] [3] [4] [7]}
Tha above matrix says that for country 1 (third column) we have totally 84 observations (column 4) on 2 variables; type of loans and interest rates (column 1 and 2 respectively). These rates are broken down by 7 regions (last column ) each of which has 4 brands (sixth column) and each brand offers 3 types of loans(fifth column) the numerical value of which is given in the first column.
The goal is to run the following multilevel regression with random effects
rates_{country}_{regions}_{brands}= a + b*type_of_loan_{country}_{regions}_{brands}+a_{regions}+c_{brands}+error_{country}_{regions}_{brands}
where the {country}_{regions}_{brands} is the index and a_{regions}+c_{brands} are random effects for regions and brands respectively.
So rates vary across countries, regions and brands and I have similar A matrices for the rest of the countries.
I am struggling to find a solution but so far I can't.
Any code provided will be greately appreciated.
thanks
  1 comentario
antonet
antonet el 28 de Sept. de 2012
Is something unclear with respect to my question?
thank you again

Iniciar sesión para comentar.

Respuestas (1)

Tom Lane
Tom Lane el 29 de Sept. de 2012
Currently anovan is the only Statistics Toolbox function (aside from a couple aimed at nonlinear fitting) that supports random effects. It also supports nested factors. It seems like it might be appropriate here.
I can't say I fully understand your problem, though. Have you tried to set it up using anovan?

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by