You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very interested in your book, "Statistical Rethinking."
I would like to use ulam for multi-level model with several predictors.
I construct a multi-level model for 420 couples’ marital satisfaction.
There are 420 couples (husband and wife).
Each of two individuals within a couple responded to 3 items of marital satisfaction.
So, 420 couples x 2 (husband and wive) x 3 (items) = 2,520 rows of data were created.
About gender, husband = -0.5, wife = 0.5.
I referred to a univariate Hierarchical Linear Model for dyads (Sayer & Klute, 2005) and tried to construct a following model.
Marital Satisfaction ij = beta 0j + beta 1j * Gender ij + r ij,
beta 0j = gamma 00 + gamma 01 * Marital Hassle + u 0j
i = 6 = 2 * 3 items
j = 420
In ulam, I wrote a following code.
It worked successfully. But, is this model right?
level 1 linear model for within_dyads variation
mu <- (a_bar+v[CoupleID,1]) + (b_bar+v[CoupleID,2])*gender,
level 2 linear model for between-dyads variation
a_bar <- aa_bar + bMH*M_hassle,
Although I thought “a_bar” as a dependent variable of level 2 linear model. If so, it should be a vector [420]. But it was a vector [2520].
But, each consecutive 6 values are the same. So, actually there is 2520 / 6 = 420.
Is this model right or not? I am confused.
I attached the full model and data structure as follows.
If not, would you please tell me how to set multi-level model using ulam?
Thank you very much in advance.
< literature >
Sayer, A.G., & Klute, M. M. (2005). Analyzing Couples and Families: Multilevel Methods. In V. L. Bengston, A. C., Acock, K. R., Allen, Dilworth-Anderson, P., & Klein, D.M. (Eds.) Sourcebook of family theory and research (pp. 289-313).
I am very interested in your book, "Statistical Rethinking."
I would like to use ulam for multi-level model with several predictors.
I construct a multi-level model for 420 couples’ marital satisfaction.
There are 420 couples (husband and wife).
Each of two individuals within a couple responded to 3 items of marital satisfaction.
So, 420 couples x 2 (husband and wive) x 3 (items) = 2,520 rows of data were created.
About gender, husband = -0.5, wife = 0.5.
I referred to a univariate Hierarchical Linear Model for dyads (Sayer & Klute, 2005) and tried to construct a following model.
Marital Satisfaction ij = beta 0j + beta 1j * Gender ij + r ij,
beta 0j = gamma 00 + gamma 01 * Marital Hassle + u 0j
i = 6 = 2 * 3 items
j = 420
In ulam, I wrote a following code.
It worked successfully. But, is this model right?
level 1 linear model for within_dyads variation
level 2 linear model for between-dyads variation
Although I thought “a_bar” as a dependent variable of level 2 linear model. If so, it should be a vector [420]. But it was a vector [2520].
But, each consecutive 6 values are the same. So, actually there is 2520 / 6 = 420.
Is this model right or not? I am confused.
I attached the full model and data structure as follows.
If not, would you please tell me how to set multi-level model using ulam?
Thank you very much in advance.
< literature >
Sayer, A.G., & Klute, M. M. (2005). Analyzing Couples and Families: Multilevel Methods. In V. L. Bengston, A. C., Acock, K. R., Allen, Dilworth-Anderson, P., & Klein, D.M. (Eds.) Sourcebook of family theory and research (pp. 289-313).
full model description
multi-level model
m001nc <- ulam(
alist(
# likelihood
M_sat ~ dnorm(mu, sigma),
sigma ~ dexp(1),
data list
dat_list <- list(
CountryID = d5$Country,
CoupleID = d5$CoupleID,
TypeID = d5$Type,
gender = d5$gender,
H_Age = standardize(d5$H_Age),
W_Age = standardize(d5$W_Age),
H_health = standardize(d5$H_health),
W_health = standardize(d5$W_health),
income = standardize(d5$income),
M_hassle = standardize(d5$M_hassle),
item = d5$item,
M_sat = standardize(d5$M_sat)
)
data structure
List of 12
$ CountryID: int [1:2520] 1 1 1 1 1 1 1 1 1 1 ...
$ CoupleID : int [1:2520] 1 1 1 1 1 1 2 2 2 2 ...
$ TypeID : int [1:2520] 4 4 4 4 4 4 5 5 5 5 ...
$ gender : num [1:2520] -0.5 -0.5 -0.5 0.5 0.5 0.5 -0.5 -0.5 -0.5 0.5 ...
$ H_Age : num [1:2520] 0.852 0.852 0.852 0.852 0.852 ...
$ W_Age : num [1:2520] 0.558 0.558 0.558 0.558 0.558 ...
$ H_health : num [1:2520] -1.36 -1.36 -1.36 -1.36 -1.36 ...
$ W_health : num [1:2520] 1.95 1.95 1.95 1.95 1.95 ...
$ income : num [1:2520] 1.61 1.61 1.61 1.61 1.61 ...
$ M_hassle : num [1:2520] 0.719 0.719 0.719 0.719 0.719 ...
$ item : int [1:2520] 1 2 3 1 2 3 1 2 3 1 ...
$ M_sat : num [1:2520] -0.195 1.004 1.004 1.004 1.004 ...
The text was updated successfully, but these errors were encountered: