Description Usage Arguments Value Note References See Also Examples

Latent budget analysis (LBA) is a method for the analysis of contingency tables, from where the compositional data is derived. It is used to understand the relationship between the table rows and columns, where the rows denote the categories of the explanatory variable and the columns denote the categories of the response variable.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ```
lba(obj, ...)
## S3 method for class 'matrix'
lba(obj,
A = NULL,
B = NULL,
K = 1L,
cA = NULL,
cB = NULL,
logitA = NULL,
logitB = NULL,
omsk = NULL,
psitk = NULL,
S = NULL,
T = NULL,
row.weights = NULL,
col.weights = NULL,
tolG = 1e-10,
tolA = 1e-05,
tolB = 1e-05,
itmax.unide = 1e3,
itmax.ide = 1e3,
trace.lba = TRUE,
toltype = "all",
method = c("ls", "mle"),
what = c("inner","outer"), ...)
## S3 method for class 'table'
lba(obj,
A = NULL,
B = NULL,
K = 1L,
cA = NULL,
cB = NULL,
logitA = NULL,
logitB = NULL,
omsk = NULL,
psitk = NULL,
S = NULL,
T = NULL,
row.weights = NULL,
col.weights = NULL,
tolG = 1e-10,
tolA = 1e-05,
tolB = 1e-05,
itmax.unide = 1e3,
itmax.ide = 1e3,
trace.lba = TRUE,
toltype = "all",
method = c("ls", "mle"),
what = c("inner","outer"), ...)
## S3 method for class 'formula'
lba(formula, data,
A = NULL,
B = NULL,
K = 1L,
cA = NULL,
cB = NULL,
logitA = NULL,
logitB = NULL,
omsk = NULL,
psitk = NULL,
S = NULL,
T = NULL,
row.weights = NULL,
col.weights = NULL,
tolG = 1e-10,
tolA = 1e-05,
tolB = 1e-05,
itmax.unide = 1e3,
itmax.ide = 1e3,
trace.lba = TRUE,
toltype = "all",
method = c("ls", "mle"),
what = c("inner","outer"), ...)
## S3 method for class 'ls'
lba(obj,
A ,
B ,
K ,
row.weights ,
col.weights ,
tolA ,
tolB ,
itmax.unide ,
itmax.ide ,
trace.lba ,
what , ...)
## S3 method for class 'mle'
lba(obj,
A ,
B ,
K ,
tolG ,
tolA ,
tolB ,
itmax.unide ,
itmax.ide ,
trace.lba ,
toltype ,
what , ...)
## S3 method for class 'ls.fe'
lba(obj,
A ,
B ,
K ,
cA ,
cB ,
row.weights ,
col.weights ,
itmax.ide ,
trace.lba , ...)
## S3 method for class 'mle.fe'
lba(obj,
A ,
B ,
K ,
cA ,
cB ,
tolG ,
tolA ,
tolB ,
itmax.ide ,
trace.lba ,
toltype , ...)
## S3 method for class 'ls.logit'
lba(obj,
A ,
B ,
K ,
cA ,
cB ,
logitA ,
logitB ,
omsk ,
psitk ,
S ,
T ,
row.weights ,
col.weights ,
itmax.ide ,
trace.lba , ...)
## S3 method for class 'mle.logit'
lba(obj,
A ,
B ,
K ,
cA ,
cB ,
logitA ,
logitB ,
omsk ,
psitk ,
S ,
T ,
itmax.ide ,
trace.lba , ...)
``` |

`obj,formula` |
The function is generic, accepting some forms of the principal argument for specifying a two-way frequency table. Currently accepted forms are matrix, data frame (coerced to frequency tables), objects of class |

`data` |
A data frame containing variables in |

`A` |
The starting value of a (I x K) matrix containing the mixing parameters, if given. The default is |

`B` |
The starting value of a (J x K) matrix containing the latent components, if given. The default is |

`K` |
Integer giving the number of latent budgets chosen by the user. The default is |

`cA` |
The value of a (I x K) matrix containing the constraints on the mixing parameters. Fixed constraints are the values themselves which are numbers in the [0,1] interval. The optional equality constraints are indicated by an integer starting from 2, such that parameters that must be equal have the same integer. The default is |

`cB` |
The value of a (J x K) matrix containing the constraints on the latent components. Fixed constraints are the values themselves which are numbers in the [0,1] interval. The optional equality constraints are indicated by an integer starting from 2, such that parameters that must be equal have the same integer. The default is |

`logitA` |
Design (IxS) matrix for row-covariates. The first column contains 1<c2><b4>s, indicating a constant covariate. The entries may be continuous or dummy coded values. |

`logitB` |
Design (JxT) matrix for column-covariates. The entries may be continuous or dummy coded values. |

`omsk` |
A (SxK) matrix giving the starting values for the multinomial logit parameters of the row covariates. The default is |

`psitk` |
A (TxK) matrix giving the starting values for the multinomial logit parameters of the column covariates. The default is |

`S` |
Number of row-covariates. The default is |

`T` |
Number of column-covariates. The default is |

`row.weights` |
Row weights for weighted least squares method. The default is |

`col.weights` |
Column weights for weighted least squares method. The default is |

`tolG` |
A tolerance value for judging when convergence has been reached. It is based on the estimated likelihood ratio statistics G2. The default is |

`tolA` |
A tolerance value for judging when convergence has been reached. When the one-iteration change in the maximum of the absolute value of the element wise difference of the estimated matrices A is less than tolA. The default is |

`tolB` |
A tolerance value for judging when convergence has been reached. When the one-iteration change in the maximum of the absolute value of the element wise difference of the estimated matrices B is less than tolB. The default is |

`itmax.unide` |
Maximum number of iterations performed by the mle or ls method, if convergence is not achieved, before identification parameters. The default is |

`itmax.ide` |
Maximum number of iterations performed by the mle or ls method in the identification process. Is used too when the constrained fixed, equality and logit are required. The default is |

`trace.lba` |
Logical, indicating whether the |

`toltype` |
String indicating which kind of tolerance to be used. That is, the EM algorithm stops updating and considers the maximum log-likelihood to have been found. Their types are: |

`method` |
String indicating which kind of estimating method. They are: |

`what` |
String indicating which kind identified solutions for mixing parameters and latent budgets matrices. They are: the |

`...` |
Further arguments (required by generic). |

The method `lba.ls`

and `lba.mle`

returns a list of class `lba.ls`

and `lba.mle`

respectively with the slots:

`P` |
The compositional data matrix which is formed by dividing the raw data matrix by their corresponding total, its rows are called observed budgets. |

`pij` |
Matrix whose rows are the expected budgets. |

`residual` |
Residual matrix |

`A` |
(I x K) matrix of the unidentified the mixing parameters. |

`B` |
(J x K) matrix of the unidentified the latent components. |

`Aoi` |
(I x K) matrix of the identified mixing parameters, they may be either the inner extreme values or the outer extreme values. |

`Boi` |
(J x K) matrix of the identified latent componentes, they may be either the inner extreme values or the outer extreme values. |

`rescB` |
(J x K) matrix of the rescaled latent components. |

`pk` |
Budget proportions. |

`val_func` |
Value of least squared or likelihood function achieved. |

`iter_unide` |
Number of unidentified iterations. |

`iter_ide` |
Number of identified iterations. |

The method `lba.ls.fe`

and `lba.mle.fe`

returns a list of class `lba.ls.fe`

and `lba.mle.fe`

respectively with the slots:

`P` |
The compositional data matrix which is formed by dividing the raw data matrix by their corresponding row total, its rows are called observed budgets. |

`pij` |
Matrix whose rows are the expected budgets. |

`residual` |
Residual matrix |

`A` |
(I x K) matrix of the unidentified the mixing parameters. |

`B` |
(J x K) matrix of the unidentified the latent components. |

`rescB` |
(J x K) matrix of the rescaled latent components. |

`pk` |
Budget proportions. |

`val_func` |
Value of least squared or likelihood function achieved. |

`iter_ide` |
Number of identified iteractions. |

The method `lba.ls.logit`

and `lba.mle.logit`

returns a list of class `lba.ls.logit`

and `lba.mle.logit`

respectively with the slots:

`P` |
The compositional data matrix which is formed by dividing the raw data matrix by their corresponding total, its rows are called observed budgets. |

`pij` |
Matrix whose rows are the expected budgets. |

`residual` |
Residual matrix |

`A` |
(I x K) matrix of the unidentified the mixing parameters. |

`B` |
(J x K) matrix of the unidentified the latent componentes. |

`rescB` |
(J x K) matrix of the rescaled latent components. |

`pk` |
Budget proportions. |

`val_func` |
Value of least squared or likelihood function achieved. |

`iter_ide` |
Number of identified iterations. |

`omsk` |
A (SxK) matrix giving estimated values of the multinomial logit parameters of the row covariates. |

`psitk` |
A (TxK) matrix giving the estimated values for the multinomial logit parameters of the column covariates. |

The user has two options to entry the data: the raw data and the tabulated data. If the raw data is imported, he may indicate which, among the variables, comprises the row and which the column variable and let the `lba.formula`

function make the tabulation. The user may also tabulate the data with the available functions in R. Recalling that if this second option is used, the object must be of the class `xtabs`

, `table`

or `matrix`

. If the user imports the tabulated data, the class is, in general, `data.frame`

and so, it is necessary to transform the object data into a `matrix`

.

The function `lba`

uses EM algorithm to maximise the latent budget model log-likelihood function; the Active Constraints Methods (ACM) to minimise either the weighted least squares (wls), or ordinary least squares (ols) functions; and "BFGS" variable metric method in `constrOptim.nl`

function of alabama package and in `optim`

function of stats package used in identification for K >= 3, in constraint algorithm for ls method, in multinomial logit constraints and in some parts of constraining for mle method. Depending on the starting parameters, those algorithms may only locate a local, rather than global, maximum. This becomes more and more of a problem as K, the number of latent budgets, increases. It is therefore highly advisable to run `lba`

multiple times until you are relatively certain that you have located the global maximum log-likelihood or the global minimum least squares.

Agresti, Alan. 2002. *Categorical Data Analysis, second edition*. Hoboken: John Wiley \& Sons.

de Leeuw, J., and van der Heijden, P.G.M. 1988. "The analysis of time-budgets with a latent time-budget model". In E. Diday (Ed.), *Data Analysis and Informatics V*. pp. 159-166. Amsterdam: North-Holland.

de Leeuw, J., van der Heijden, P.G.M., and Verboon, P. 1990. "A latent time budget model". *Statistica Neerlandica*. 44, 1, 1-21.

Dempster, A.P., Laird, N.M., and Rubin, D.B. 1977. "Maximum likelihood from incomplete data via the EM algorithm". *Journal of the Royal Statistical Society, Series*. 39, 1-38.

van der Ark, A.L. 1999. *Contributions to Latent Budget Analysis, a tool for the analysis of comositional data*. Ph.D. Thesis University of Utrecht.

van der Heijden, P.G.M., Mooijaart, A., and de Leeuw, J. 1992. "Constrained latent budget analysis". In P.V. Marsden (Ed.), *Sociological Methodology* pp. 279-320. Cambridge: Blackwell Publishers.

`goodnessfit`

, `summary.lba.ls`

,`summary.lba.mle`

,`plotlba`

,`plotcorr`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ```
data('votB')
# Using LS method (default) without constraint
# K = 2
ex1 <- lba(parties ~ city,
votB,
K = 2)
ex1
# Already tabulated data? Ok!
data('PerfMark')
## Not run:
ex2 <- lba(as.matrix(PerfMark),
K = 2,
what='outer')
ex2
## End(Not run)
# Using LS method (default) with constraint
# Fixed constraint to mixing parameters
cakiF1 <- matrix(c(0.2, NA, NA,
NA , NA,0.2,
NA , NA,0.2,
0.3, NA, NA,
0.2, NA, NA,
NA , NA, NA),
byrow = TRUE,
ncol = 3)
# K = 3
## Not run:
exf1 <- lba(parties ~ city,
votB,
cA = cakiF1,
K = 3)
exf1
## End(Not run)
# Using LS method (default) with LOGIT constrain
data('housing')
# Make cross-table to matrix design.
tbh <- xtabs(value ~ Influence + Housing, housing)
Xis <- model.matrix(~ Housing*Influence,
tbh,
contrasts=list(Housing='contr.sum',
Influence='contr.sum'))
tby <- xtabs(value ~ Satisfaction + Contact, housing)
Yis <- model.matrix(~ Satisfaction*Contact,
tby,
contrasts=list(Satisfaction='contr.sum',
Contact='contr.sum'))[,-1]
S <- 12
T <- 5
tabs <- xtabs(value ~ interaction(Housing,
Influence) + interaction(Satisfaction,
Contact),
housing)
## Not run:
exlogit2 <- lba(tabs,
K = 2,
logitA = Xis,
logitB = Yis,
S = S,
T = T,
trace.lba=FALSE)
exlogit2
## End(Not run)
``` |

lba documentation built on July 12, 2017, 1:02 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.