简体   繁体   English

重复测量:由连续和分类预测器预测的连续结果

[英]Repeated measures: continuous outcome predicted by continous and categorical predictors

I have the following variables and if they were in wide format I would calculate something like我有以下变量,如果它们是宽格式,我会计算类似

lm(happiness ~ personality_trait*condition)

But my data is in long format.但是我的数据是长格式的。 I suppose it will be a repeated measures model but I'm not sure.我想这将是一个重复的措施 model 但我不确定。 I considered Linear Mixed Models but I'm not sure if I understood and whether it is what I'm looking for.我考虑过线性混合模型,但我不确定我是否理解以及它是否是我正在寻找的。

Thanks a lot!非常感谢!

participant参与者 personality_trait1个性特质1 condition (健康)状况 happiness幸福
1 1 10 10 animal动物 5 5
1 1 10 10 human人类 7 7
2 2 2 2 animal动物 3 3
2 2 2 2 human人类 4 4
3 3 5 5 animal动物 6 6
3 3 5 5 human人类 2 2

I think我认为

library(lme4)
lmer(happiness ~ personality_trait*condition + (1|participant), data= ...)

should do it.应该这样做。 This allows for a different intercept for each individual, drawn from a Gaussian distribution around the population mean intercept).这允许每个个体有不同的截距,从总体平均截距周围的高斯分布中得出)。 In some situations you could also fit a random slopes model (different slope for each individual), but in this case it wouldn't make sense since you appear to have only two observations per individual (thus, estimates of variation in slope would be confounded with the residual variation: see here for an example).在某些情况下,您还可以拟合随机斜率 model (每个人的斜率不同),但在这种情况下,这没有意义,因为您似乎每个人只有两个观察值(因此,斜率变化的估计会被混淆残差变化:见这里的例子)。

Are your samples always in the order "animal, then human"?您的样本总是按照“动物,然后是人类”的顺序排列吗? If not, you might want to add a subject-level fixed effect of order...如果没有,您可能需要添加一个主题级别的固定效果的顺序...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 哪种类型的分析具有连续和分类预测因子的分类结果? - What type of analysis with categorical outcome with both continuous and categorical predictors? 计算重复测量设计的结果比例 - Compute proportion of outcome from repeated measures design 可视化连续预测变量与分类结果之间的关系 - Visualizing the relationship between a continuous predictor and a categorical outcome 如何在多重插补中同时使用分类和连续预测变量 [r] - How to use both categorical and continuous predictors in a multiple imputation [r] Matlab / R-具有分类和连续预测变量的线性回归-为什么连续预测变量平方? - Matlab/R - linear regression with categorical & continuous predictors - why is the continuous predictor squared? 当我们同时具有连续变量和分类变量作为预测变量时,如何在多项逻辑回归中检验多重共线性? - How to test multicollinearity in multinomial logistic regression when we have both continuous variables as well categorical variables as predictors? 如何使用scikit-learn预测具有分类和连续特征的二进制结果? - how to predict binary outcome with categorical and continuous features using scikit-learn? 具有类别预测变量的R中的Logistic回归 - Logistic Regression in R with Categorical Predictors 如何在 plot 中绘制带有重复测量变量和连续变量的散点图 r? - How do I plot a scatterplot graph with a repeated-measures variable and a continuous variable in r? 重复测量方差分析 - Repeated measures ANOVA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM