Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions inst/qml/MixedModelsBGLMM.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ import JASP.Controls
import "./common" as MM

Form {
info: qsTr("Bayesian Generalized Linear Mixed Models allow you to model a linear relationship between one or more explanatory variable(s) and a continuous dependent variable in cases where the observations are not independent, but clustered within one or several random effects grouping factors (e.g., repeated measures across participants or items, children within schools). They are generalizations of Bayesian Linear Mixed Models and allow you to model response variables that are not continuous using different likelihoods and link functions.") + "\n" +
"## " + qsTr("Assumptions") + "\n" +
"- " + qsTr("Linearity and additivity: The response variable is related to all predictors according to the link function and the effects of the predictors are additive on the linear scale.") + "\n" +
"- " + qsTr("Independence of errors: The errors are uncorrelated with each other after taking the model (i.e., fixed effects and random effects structure) into account.") + "\n" +
"- " + qsTr("Homoscedasticity: The error variance of each predictor is constant across all values of that predictor.") + "\n" +
"- " + qsTr("Distribution of errors: The errors are distributed according to the distributional family.") + "\n\n" +
qsTr("The analysis uses orthonormal contrasts such that the marginal prior on all fixed effects is identical for categorical (nominal and ordinal) predictors (R uses dummy encoding by default). This scheme is used for better interpretability of models with interactions. However, the fixed and random effect estimates will differ from those obtained from R with default settings. We advise using the 'Estimated marginal means' section for obtaining mean estimates at individual factor levels. For comparing the mean estimates, use the contrasts option.") + "\n\n" +
qsTr("The analysis uses a long data format.") + "\n\n" +
qsTr("The prior distributions are weakly informative and should be well-behaved in parameter estimation settings. The module uses the default prior distribution settings of the rstanarm R package which defines normal(location = 0, scale = 2.5) prior distributions on scaled and centered model coefficients.")

id: form

Formula
Expand All @@ -43,7 +53,7 @@ Form {
AssignedVariablesList
{
name: "dependent"
title: qsTr("Dependent variable")
title: qsTr("Dependent variable"); info: qsTr("Dependent (response) variable.")
allowedColumns: ["scale", "nominal"]
allowTypeChange: true
singleVariable: true
Expand All @@ -53,7 +63,7 @@ Form {
{
visible: active
name: "dependentAggregation"
title: qsTr("Number of trials")
title: qsTr("Number of trials"); info: qsTr("Number of trials, only applicable if the Binomial (aggregated) family is selected.")
singleVariable: true
allowedColumns: ["scale"]

Expand All @@ -66,15 +76,15 @@ Form {
AssignedVariablesList
{
name: "fixedVariables"
title: qsTr("Fixed effects variables")
title: qsTr("Fixed effects variables"); info: qsTr("Variables used as the fixed effects predictors (the model terms can be specified under Model section). These are usually the variables of primary scientific interest.")
allowedColumns: ["nominal", "scale"]
allowTypeChange: true
}

AssignedVariablesList
{
name: "randomVariables"
title: qsTr("Random effects grouping factors")
title: qsTr("Random effects grouping factors"); info: qsTr("Categorical variable(s) specifying clusters of observations (i.e., several observations per level of a random effects grouping factor). These are typically variables, such as participants or items, one wants to generalize over. Factors with very few levels (i.e., fewer than five or six levels) should not be used as random effects grouping factors as the number of levels determines the power of the test of the fixed effects tests (Westfall, Kenny, & Judd, 2014). The random effects structure (i.e., random intercepts, random slopes, and correlations among random effects parameters) can be specified under Model - Random effects. The default random effects structure is the automatically determined 'maximal random effects structure justified by the design' (Barr, Levy, Scheepers, & Tily, 2013).")
allowedColumns: ["nominal"]
}
}
Expand All @@ -84,7 +94,7 @@ Form {
DropDown
{
name: "family"
label: qsTr("Family")
label: qsTr("Family"); info: qsTr("Distribution function whose likelihood will be used for the dependent variable. Several options are available.")
id: family
indexDefaultValue: 0
values:
Expand Down Expand Up @@ -140,7 +150,7 @@ Form {
{
id: link
name: "link"
title: qsTr("Link")
title: qsTr("Link"); info: qsTr("Link function that will be used to model the mean parameter of the selected distribution function.")
radioButtonsOnSameRow: true

RadioButton
Expand Down Expand Up @@ -235,29 +245,29 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsMeans"
title: qsTr("Model variables")
title: qsTr("Model variables"); info: qsTr("Fixed effects variables that can be used for computing estimated marginal means.")
source: [{ name: "fixedEffects", use: "noInteraction" }]
}

AssignedVariablesList
{
id: marginalMeans
name: "marginalMeansTerms"
title: qsTr("Selected variables")
title: qsTr("Selected variables"); info: qsTr("Variables for which the estimated marginal means will be computed.")
}
}

CIField
{
name: "marginalMeansCiLevel"
label: qsTr("Confidence interval")
label: qsTr("Confidence interval"); info: qsTr("Width of the confidence interval. Set at 95% by default, which can be changed by the user.")
}

DoubleField
{
id: marginalMeansSD
name: "marginalMeansSd"
label: qsTr("SD factor covariates")
label: qsTr("SD factor covariates"); info: qsTr("Specifies the 'levels' of continuous variables (expressed in standard deviations) for which the estimated marginal means are computed.")
defaultValue: 1
min: 0
enabled: marginalMeans.columnsTypes.includes("scale")
Expand All @@ -266,15 +276,15 @@ Form {
CheckBox
{
name: "marginalMeansResponse"
label: qsTr("Response scale")
label: qsTr("Response scale"); info: qsTr("Whether the estimated marginal means should be computed on the response scale or untransformed linear scale. The response scale is selected by default.")
checked: true
}

CheckBox
{
name: "marginalMeansContrast"
id: marginalMeansContrast
label: qsTr("Specify contrasts")
label: qsTr("Specify contrasts"); info: qsTr("Creates a table for specifying contrasts based on the estimated marginal means. The first column contains row indices corresponding to the estimated marginal means output table. Columns with variable names show the levels of each variable for the respective marginal mean. Columns labeled ‘Contrast x’ are used to define contrasts. To specify a contrast between two marginal means, enter -1 and 1 in the corresponding rows. Interactions can be tested by defining differences in marginal means of one variable across levels of another.")
}

CustomContrastsTableView
Expand All @@ -299,15 +309,15 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsTrends1"
title: qsTr("Continous variables")
title: qsTr("Continous variables"); info: qsTr("Continuous fixed effects variables that can be used for estimating the conditional slopes.")
source: [ { name: "fixedEffects", use: "type=scale"} ]
}

AssignedVariablesList
{
singleVariable: true
name: "trendsTrendVariable"
title: qsTr("Trend variable")
title: qsTr("Trend variable"); info: qsTr("Variables for which the estimated conditional slopes will be computed.")
}
}

Expand All @@ -318,29 +328,29 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsTrends2"
title: qsTr("Model variables")
title: qsTr("Model variables"); info: qsTr("Fixed effects variables over which the conditional slopes can be computed.")
source: [{ name: "fixedEffects", use: "noInteraction" }]
}

AssignedVariablesList
{
id: trendsVariables
name: "trendsVariables"
title: qsTr("Selected variables")
title: qsTr("Selected variables"); info: qsTr("Variables over which the conditional slopes will be computed.")
}
}

CIField
{
name: "trendsCiLevel"
label: qsTr("Confidence interval")
label: qsTr("Confidence interval"); info: qsTr("Width of the confidence interval. Set at 95% by default, which can be changed by the user.")
}

DoubleField
{
id: trendsSD
name: "trendsSd"
label: qsTr("SD factor covariates")
label: qsTr("SD factor covariates"); info: qsTr("Specifies the 'levels' of continuous variables (expressed in standard deviations) over which the conditional slopes are computed.")
defaultValue: 1
min: 0
enabled: trendsVariables.columnsTypes.includes("scale")
Expand All @@ -350,7 +360,7 @@ Form {
{
name: "trendsContrast"
id: trendsContrast
label: qsTr("Specify contrasts")
label: qsTr("Specify contrasts"); info: qsTr("Creates a table for specifying contrasts based on the estimated conditional slopes. The first column contains row indices corresponding to the estimated conditional slopes output table. Columns with variable names show the levels of each variable for the respective conditional slope. Columns labeled ‘Contrast x’ are used to define contrasts. To specify a contrast between two conditional slopes, enter -1 and 1 in the corresponding rows. Interactions can be tested by defining differences in conditional slopes of one variable across levels of another.")
}

CustomContrastsTableView
Expand Down
41 changes: 26 additions & 15 deletions inst/qml/MixedModelsBLMM.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ import JASP.Controls
import "./common" as MM

Form {
info: qsTr("Bayesian Linear Mixed Models allow you to model a linear relationship between one or more explanatory variable(s) and a continuous dependent variable in cases where the observations are not independent, but clustered within one or several random effects grouping factors (e.g., repeated measures across participants or items, children within schools). An introduction to this model class and the concepts introduced below is provided in Singmann and Kellen (2019).") + "\n" +
"## " + qsTr("Assumptions") + "\n" +
"- " + qsTr("Continuous response variable.") + "\n" +
"- " + qsTr("Linearity and additivity: The response variable is linearly related to all predictors and the effects of the predictors are additive.") + "\n" +
"- " + qsTr("Independence of errors: The errors are uncorrelated with each other after taking the model (i.e., fixed effects and random effects structure) into account.") + "\n" +
"- " + qsTr("Homoscedasticity: The error variance of each predictor is constant across all values of that predictor.") + "\n" +
"- " + qsTr("Normality of errors: The errors are normally distributed with mean zero.") + "\n\n" +
qsTr("The analysis uses orthonormal contrasts such that the marginal prior on all fixed effects is identical for categorical (nominal and ordinal) predictors (R uses dummy encoding by default). This scheme is used for better interpretability of models with interactions. However, the fixed and random effects estimates will differ from those obtained from R with default settings. We advise using the 'Estimated marginal means' section for obtaining mean estimates at individual factor levels. For comparing the mean estimates, use the contrasts option.") + "\n\n" +
qsTr("The analysis uses a long data format.") + "\n\n" +
qsTr("The prior distributions are weakly informative and should be well-behaved in parameter estimation settings. The module uses the default prior distribution settings of the rstanarm R package which defines normal(location = 0, scale = 2.5) prior distributions on scaled and centered model coefficients.")

id: form

Formula
Expand All @@ -42,23 +53,23 @@ Form {
AssignedVariablesList
{
name: "dependent"
title: qsTr("Dependent variable")
title: qsTr("Dependent variable"); info: qsTr("Dependent (response) variable.")
allowedColumns: ["scale"]
singleVariable: true
}

AssignedVariablesList
{
name: "fixedVariables"
title: qsTr("Fixed effects variables")
title: qsTr("Fixed effects variables"); info: qsTr("Variables used as the fixed effects predictors (the model terms can be specified under Model section). These are usually the variables of primary scientific interest.")
allowedColumns: ["nominal", "scale"]
allowTypeChange: true
}

AssignedVariablesList
{
name: "randomVariables"
title: qsTr("Random effects grouping factors")
title: qsTr("Random effects grouping factors"); info: qsTr("Categorical variable(s) specifying clusters of observations (i.e., several observations per level of a random effects grouping factor). These are typically variables, such as participants or items, one wants to generalize over. Factors with very few levels (i.e., fewer than five or six levels) should not be used as random effects grouping factors as the number of levels determines the power of the test of the fixed effects tests (Westfall, Kenny, & Judd, 2014). The random effects structure (i.e., random intercepts, random slopes, and correlations among random effects parameters) can be specified under Model - Random effects. The default random effects structure is the automatically determined 'maximal random effects structure justified by the design' (Barr, Levy, Scheepers, & Tily, 2013).")
allowedColumns: ["nominal"]
}
}
Expand Down Expand Up @@ -89,29 +100,29 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsMeans"
title: qsTr("Model variables")
title: qsTr("Model variables"); info: qsTr("Fixed effects variables that can be used for computing estimated marginal means.")
source: [{ name: "fixedEffects", use: "noInteraction" }]
}

AssignedVariablesList
{
id: marginalMeans
name: "marginalMeansTerms"
title: qsTr("Selected variables")
title: qsTr("Selected variables"); info: qsTr("Variables for which the estimated marginal means will be computed.")
}
}

CIField
{
name: "marginalMeansCiLevel"
label: qsTr("Confidence interval")
label: qsTr("Confidence interval"); info: qsTr("Width of the confidence interval. Set at 95% by default, which can be changed by the user.")
}

DoubleField
{
id: marginalMeansSD
name: "marginalMeansSd"
label: qsTr("SD factor covariates")
label: qsTr("SD factor covariates"); info: qsTr("What should be the 'levels' of continuous variables (expressed in standard deviations) for which the estimated marginal means are computed.")
defaultValue: 1
min: 0
enabled: marginalMeans.columnsTypes.includes("scale")
Expand All @@ -121,7 +132,7 @@ Form {
{
name: "marginalMeansContrast"
id: marginalMeansContrast
label: qsTr("Specify contrasts")
label: qsTr("Specify contrasts"); info: qsTr("Creates a table for specifying contrasts based on the estimated marginal means. The first column contains row indices corresponding to the estimated marginal means output table. Columns with variable names show the levels of each variable for the respective marginal mean. Columns labeled ‘Contrast x’ are used to define contrasts. To specify a contrast between two marginal means, enter -1 and 1 in the corresponding rows. Interactions can be tested by defining differences in marginal means of one variable across levels of another.")
}

CustomContrastsTableView
Expand All @@ -146,15 +157,15 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsTrends1"
title: qsTr("Continous variables")
title: qsTr("Continous variables"); info: qsTr("Continuous fixed effects variables that can be used for estimating the conditional slopes.")
source: [ { name: "fixedEffects", use: "type=scale"} ]
}

AssignedVariablesList
{
singleVariable: true
name: "trendsTrendVariable"
title: qsTr("Trend variable")
title: qsTr("Trend variable"); info: qsTr("Variables for which the estimated conditional slopes will be computed.")
}
}

Expand All @@ -165,29 +176,29 @@ Form {
AvailableVariablesList
{
name: "availableModelComponentsTrends2"
title: qsTr("Model variables")
title: qsTr("Model variables"); info: qsTr("Fixed effects variables over which the conditional slopes can be computed.")
source: [{ name: "fixedEffects", use: "noInteraction" }]
}

AssignedVariablesList
{
id: trendsVariables
name: "trendsVariables"
title: qsTr("Selected variables")
title: qsTr("Selected variables"); info: qsTr("Variables over which the conditional slopes will be computed.")
}
}

CIField
{
name: "trendsCiLevel"
label: qsTr("Confidence interval")
label: qsTr("Confidence interval"); info: qsTr("Width of the confidence interval. Set at 95% by default, which can be changed by the user.")
}

DoubleField
{
id: trendsSD
name: "trendsSd"
label: qsTr("SD factor covariates")
label: qsTr("SD factor covariates"); info: qsTr("What should be the 'levels' of continuous variables (expressed in standard deviations) over which the conditional slopes are computed.")
defaultValue: 1
min: 0
enabled: trendsVariables.columnsTypes.includes("scale")
Expand All @@ -197,7 +208,7 @@ Form {
{
name: "trendsContrast"
id: trendsContrast
label: qsTr("Specify contrasts")
label: qsTr("Specify contrasts"); info: qsTr("Creates a table for specifying contrasts based on the estimated conditional slopes. The first column contains row indices corresponding to the estimated conditional slopes output table. Columns with variable names show the levels of each variable for the respective conditional slope. Columns labeled ‘Contrast x’ are used to define contrasts. To specify a contrast between two conditional slopes, enter -1 and 1 in the corresponding rows. Interactions can be tested by defining differences in conditional slopes of one variable across levels of another.")
}

CustomContrastsTableView
Expand Down
Loading
Loading