gpt4 book ai didi

spss - 如何在 SPSS 中的一个散点图中对具有不同趋势(包括线性和立方)的不同线应用拟合线?

转载 作者:行者123 更新时间:2023-12-01 16:21:58 25 4
gpt4 key购买 nike

我有一个包含三种处理的散点图,我想应用每种治疗的最佳拟合线。 SPSS 中是否有任何方法可以在一种处理中应用拟合线而不影响一个图中的其他处理。非常感谢任何建议

最佳答案

这是我在 NABBLE SPSS list-serve 上发布的同义问题的逐字记录:

Here is the best solution I could come up with. In a nutshell it makes two grouping variables and then maps the one group to a 100% transparent element. Then it just has two element calls in the GPL (in this example one for linear and one for quadratic).

Of course the most flexible solution would be to actually fit the models for each group and put the predicted values as a new variable in the dataset, but this didn't work out too badly (the legend didn't even turn out that badly).

**********************************************.
set seed = 10.
input program.
loop #i = 1 to 100.
if #i <= 50 group = 0.
if #i > 50 group = 1.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.

compute x = RV.NORM(0,1).
if group = 0 outcome = x + RV.NORM(0,0.1).
if group = 1 outcome = x**2 + RV.NORM(0,0.1).

compute group_square = (group = 1).
compute group_linear = (group = 0).
formats all (F1.0).
exe.


DATASET ACTIVATE sim.
* Chart Builder.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=x outcome group_square group_linear group
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: x=col(source(s), name("x"))
DATA: outcome=col(source(s), name("outcome"))
DATA: group=col(source(s), name("group"), unit.category())
DATA: group_square=col(source(s), name("group_square"), unit.category())
DATA: group_linear=col(source(s), name("group_linear"), unit.category())
GUIDE: axis(dim(1), label("x"))
GUIDE: axis(dim(2), label("outcome"))
GUIDE: legend(aesthetic(aesthetic.transparency), null())
SCALE: cat(aesthetic(aesthetic.transparency), map(("0", transparency."1.0"), ("1", transparency."0.0")))
ELEMENT: point(position(x*outcome), color.exterior(group))
ELEMENT: line(position(smooth.linear(x*outcome)), transparency.interior(group_linear), color.interior(group))
ELEMENT: line(position(smooth.quadratic(x*outcome)), transparency.interior(group_square), color.interior(group))
END GPL.
**********************************************.

curves with different fit lines
(来源:nabble.com)

关于spss - 如何在 SPSS 中的一个散点图中对具有不同趋势(包括线性和立方)的不同线应用拟合线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12656394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com