楼主: flytaigerfox
9946 8

刚学stata...请教.两个简单的问题.. [推广有奖]

  • 1关注
  • 1粉丝

高中生

2%

还不是VIP/贵宾

-

威望
0
论坛币
3 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
150 点
帖子
15
精华
0
在线时间
16 小时
注册时间
2012-2-22
最后登录
2022-2-8

楼主
flytaigerfox 发表于 2012-2-25 00:17:25 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
第一,就是怎么换行输入两条命令 因为回车就直接执行了 ,可以输入两条以上的命令么
第二,就是预测命令predict, 我用regress y x回归后,怎么样对y预测呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Stata tata predict regress Pred

沙发
sungmoo 发表于 2012-2-25 07:38:09
第一,就是怎么换行输入两条命令 因为回车就直接执行了 ,可以输入两条以上的命令么
https://bbs.pinggu.org/thread-309324-1-1.html

藤椅
sungmoo 发表于 2012-2-25 07:39:24
第二,就是预测命令predict, 我用regress y x回归后,怎么样对y预测呢?
predict yh

板凳
蓝色 发表于 2012-2-25 09:04:27
Examples

    -----------------------------------------------------------------------------------------------
    Setup
        . sysuse auto
        . regress mpg weight c.weight#c.weight foreign

    Obtain predicted values
        . predict pmpg
        . summarize pmpg mpg

    -----------------------------------------------------------------------------------------------
    Setup
        . webuse newautos, clear

    Obtain out-of-sample prediction
        . predict mpg

    Obtain standard error of the forecast
        . predict se_mpg, stdf

    -----------------------------------------------------------------------------------------------
    Setup
        . sysuse auto, clear
        . regress price weight foreign##c.mpg

    Residual-versus-fitted plot
        . rvfplot, yline(10)

    Added-variable plot
        . avplot mpg

    Added-variable plots for every regressor
        . avplots

    -----------------------------------------------------------------------------------------------
    Setup
        . webuse auto1
        . regress price mpg weight

    Component-plus-residual plot
        . cprplot mpg, mspline msopts(bands(13))

    Augmented component-plus-residual plot
        . acprplot mpg, mspline msopts(bands(13))

    Residual-versus-predictor plot
        . rvpplot mpg, yline(0)

    -----------------------------------------------------------------------------------------------
    Setup
        . sysuse auto
        . regress mpg weight c.weight#c.weight foreign

    Diagonal elements of projection matrix
        . predict xdist, hat

    -----------------------------------------------------------------------------------------------
    Setup
        . sysuse auto, clear
        . regress price weight foreign##c.mpg

    Leverage-versus-residual-squared plot
        . lvr2plot

    Standardized residuals
        . predict esta if e(sample), rstandard

    Studentized residuals
        . predict estu if e(sample), rstudent

    -----------------------------------------------------------------------------------------------
    Setup
        . sysuse auto, clear
        . regress price weight foreign##c.mpg

    DFITS influence measure
        . predict dfits, dfits

    Cook's distance
        . predict cooksd if e(sample), cooksd

    Welsch distance
        . predict wd, welsch

    COVRATIO influence measure
        . predict covr, covratio

    DFBETAs influence measure
        . sort foreign make
        . predict dfor, dfbeta(1.foreign)

    DFBETAs for all variables in regression
        . dfbeta

    Ramsey's test for omitted variables
        . estat ovtest

    Test for heteroskedasticity
        . estat hettest
        . estat hettest weight foreign##c.mpg, mtest(b)

    Rank test for heteroskedasticity
        . estat szroeter, rhs mtest(holm)

    Tests for heteroskedasticity, skewness, and kurtosis
        . estat imtest

    -----------------------------------------------------------------------------------------------
    Setup
        . webuse bodyfat, clear
        . regress bodyfat tricep thigh midarm

    Variance inflation factors
        . estat vif

    -----------------------------------------------------------------------------------------------
    Setup
        . webuse nhanes2

    Regress systolic blood pressure on age group, sex, and their interaction
        . regress bpsystol agegrp##sex

    Predictive margins of blood pressure for age groups
        . margins agegrp

    Profile plot of margins
        . marginsplot

    Margins for interaction between age group and sex
        . margins agegrp#sex

    Interaction plot
        . marginsplot

    Estimate for each age group a contrast comparing men and women
        . margins r.sex@agegrp

    Plot contrasts and confidence intervals against age group
        . marginsplot

报纸
蓝色 发表于 2012-2-25 09:05:38
论坛上面已经有很多初级的,stata的,中文的书了。
那几本书随便把一本看看,这些问题懂能自己解决了。

地板
flytaigerfox 发表于 2012-2-25 11:52:52
sungmoo 发表于 2012-2-25 07:39
predict yh
(option xb assumed; fitted values)

这个怎么处理呢

7
flytaigerfox 发表于 2012-2-25 11:54:01
蓝色 发表于 2012-2-25 09:05
论坛上面已经有很多初级的,stata的,中文的书了。
那几本书随便把一本看看,这些问题懂能自己解决了。
好的 谢谢!
这得怪自己了 一直没看书 导师又催的交东西!
哎.....加油加油

8
sungmoo 发表于 2012-2-25 12:00:34
(option xb assumed; fitted values)
这个怎么处理呢
你要的不正是fitted values?

9
蓝色 发表于 2012-2-25 20:38:03
Syntax for predict

        predict [type] newvar [if] [in] [, statistic]

    statistic            Description
    -----------------------------------------------------------------------
    Main
     xb                 linear prediction; the default
      residuals          residuals
      score              score; equivalent to residuals
      rstandard          standardized residuals
      rstudent           Studentized (jackknifed) residuals
      cooksd             Cook's distance
      leverage | hat     leverage (diagonal elements of hat matrix)
      pr(a,b)            Pr(y | a < y < b)
      e(a,b)             E(y | a < y < b)
      ystar(a,b)         E(y*), y* = max(a,min(y,b))
    * dfbeta(varname)    DFBETA for varname
      stdp               standard error of the linear prediction
      stdf               standard error of the forecast
      stdr               standard error of the residual
    * covratio           COVRATIO
    * dfits              DFITS
    * welsch             Welsch distance
    ----------------------------------------------------------------------------------------------
    Unstarred statistics are available both in and out of sample; type predict ... if e(sample) ... if wanted only for the estimation sample.  Starred statistics are calculated only for the estimation sample, even when if e(sample) is not specified.
    rstandard, rstudent, cooksd, leverage, dfbeta(), stdf, stdr, covratio, dfits, and welsch are not available if any vce() other than vce(ols) was specified with regress.
    xb, residuals, score, and stdp are the only options allowed with svy estimation results.

    where a and b may be numbers or variables; a missing (a > .) means minus infinity, and b missing (b > .) means   plus infinity; see missing.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-2 18:54