问题描述
背景:我有一个分类变量 X ,它具有四个适合作为单独的虚拟变量的级别。因此,共有三个虚拟变量,分别代表x = 1,x = 2,x = 3(x = 0是基线)。
Background: I have a categorical variable, X, with four levels that I fit as separate dummy variables. Thus, there are three total dummy variables representing x=1, x=2, x=3 (x=0 is baseline).
问题/问题:我希望能够计算这些假人的线性组合(即使用SAS作为计算器)的值变量。例如2 * B1 + 2 * B2 + B3。
Problem/issue: I want to be able to calculate the value of a linear combination (i.e. using SAS as a calculator) of these dummy variables. For example, 2*B1 + 2*B2 + B3.
在Stata中,可以使用 lincom 命令,它使用存储的beta估计值来计算参数的线性组合。
In Stata, this can be done using the
lincom
command, which uses the stored beta estimates to calculate linear combinations of the parameters.
在SAS中,例如PROC GLM,我应该使用
ESTIMATE
语句,但是我不确定在这种情况下如何为每个变量指定权重。
In SAS in a procedure such as PROC GLM, I think I should use the
ESTIMATE
statement, but I'm not sure how I would specify the "weights" for each variable in this case.
推荐答案
您正在寻找PROC SCORE。这将进行输出回归或因子估计,并对新数据集评分。请参阅此处的示例。
You are looking for PROC SCORE. This takes output regression or factor estimates and scores a new data set. See here for an example. http://support.sas.com/documentation/cdl/en/statug/66859/HTML/default/viewer.htm#statug_score_examples02.htm
这篇关于“自动”使用PROC GLM计算参数估计值的线性组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!