我的手机yy如何关闭声音sim卡关闭,还没声音怎么办

苹果/安卓/wp
积分 209, 距离下一级还需 51 积分
权限: 自定义头衔
道具: 彩虹炫, 涂鸦板, 雷达卡, 热点灯, 金钱卡, 显身卡, 匿名卡下一级可获得
权限: 签名中使用图片
购买后可立即获得
权限: 隐身
道具: 金钱卡, 彩虹炫, 雷达卡, 热点灯, 涂鸦板
我有个变量是民族nationality。有三个民族nationality=1;=2=3
想用xi建立虚拟变量,为什么建立失败,同时给出的提示见下:
. xi& &i. nationality
varlist required
这个“varlist required”到底是指哪个地方出错了?&&谢谢各位!
支持楼主:、
购买后,论坛将把您花费的资金全部奖励给楼主,以表示您对TA发好贴的支持
载入中......
xi& &i.nationality
大概猜了一下,你命令&&i. 后面多了一个空格
我试过了 xi+空格+i+空格+.+空格+nationality。 为什么stata打出来这个命令后,后面就什么都没有了。也没有提示这个命令是对还是错。但这个命令没有标注红色。求教求教!
. xi i .nationality
敲出来后stata就一直这样,没有后面的输出了。。。
Trade Economicist
pooreco 发表于
. xi i .nationality
.i和点之间没有空格& &试试
回归时候可以用 xi:i.varname,一般转换虚拟变量就不能用这个命令了
. xi i.foreign
i.foreign& && && &_Iforeign_0-1& && & ( _Iforeign_0 omitted)
. xi&&i.rep78
i.rep78& && && &&&_Irep78_1-5& && && &( _Irep78_1 omitted)
观点有启发
总评分:&经验 + 60&
学术水平 + 1&
热心指数 + 1&
蓝色 发表于
没有问题这里菜鸟想问版主个问题~~xi生成虚拟变量会导致第一类虚拟变量omitted,这样不会有问题么?用tab生成就不会omitted啊~
虽然按照虚拟变量数量设定原则:“(1)如果回归模型有截距项:有m种互斥的属性类型,在模型中引入(m-1)个虚拟变量(2)如果回归模型无截距项,有m个特征,设置m个虚拟变量”。但是,用xi设定虚拟变量时并不知道回归模型是否要设截距项啊?
dogboy555 发表于
这里菜鸟想问版主个问题~~xi生成虚拟变量会导致第一类虚拟变量omitted,这样不会有问题么?用tab生成就不会 ...横截面数据是需要截距项才能使得模型的R^2在0-1之间额。
xddlovejiao1314 发表于
横截面数据是需要截距项才能使得模型的R^2在0-1之间额。嗯嗯,谢谢您~我知道正常是要有截距项的。就是好奇如果有模型没有截距项用xi生成dummy被omitted这样就不对了吧?
初级热心勋章
初级热心勋章
中级热心勋章
中级热心勋章
初级信用勋章
初级信用勋章
初级学术勋章
初级学术勋章
中级学术勋章
中级学术勋章
中级信用勋章
中级信用勋章
高级热心勋章
高级热心勋章
高级信用勋章
高级信用勋章
一级伯乐勋章
一级伯乐勋章
高级学术勋章
高级学术勋章
特级热心勋章
高级热心勋章
特级学术勋章
特级学术勋章
特级信用勋章
高级信用勋章
无限扩大经管职场人脉圈!每天抽选10位免费名额,现在就扫& 论坛VIP& 贵宾会员& 可免费加入
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
如有投资本站或合作意向,请联系(010-);
邮箱:service@pinggu.org
投诉或不良信息处理:(010-)
京ICP证090565号
论坛法律顾问:王进律师stata生成虚拟变量的多种方法
auto,clear
********将一个分类变量生成多个虚拟变量
****xi命令
xi i.rep78 // 针对rep78(定类变量)生成虚拟变量
****tab命令
tab rep78,gen(dummy_rep78)
//自动生成5个虚拟变量,尤其对于年份的虚拟变量比较管用
reg price length dummy* //dummy*
等同于rep78生成的5个虚拟变量,reg命令会自动剔除一个保证不会出现共线性问题。
********以下是将一个分类或连续变量生成一个虚拟变量
****gen命令
gen rep_1=(rep78==1|rep78==2)
//把变量取值12345的rep78变成赋值为1、0的虚拟变量
gen p=price
recode p 0/00/50000=1 //针对price(定距变量)生成虚拟变量
,并列出频次
replace p=1 if price&10000 //另一种方法
gen p=price&10000 //(price&10000取1,否则取0)又一种快捷方法
虚拟变量经常用。
怎么生成虚拟变量?
1、利用gen慢慢写
2、利用tab var,gen(dummy)
3、不生成,直接xi:**** i.var
对于连续变量时候,tab、recode和xi就不行了。
这时候,还是todummy上场。
ssc install todummy
sysuse nlsw88 ,clear
*按中点生成虚拟变量
todummy wage ,median
*分段生成虚拟变量
todummy age ,values(45 \ 40 \ = 38 40) cut
*还有很多用法,help下吧
有时候,很多类型变量,想从中生成虚拟,又不愿意一个一个地写。
recode是可以尝试一下的
recode var1 (1 3&5 =0)(2 4
6=1),gen(var_new)
*将var1中的 1 3 5 生成 0; 2 4 6变成 1
recode var2 100/max=1 50/100=0 0/50=-1,gen(var_new2)
*分段生产虚拟
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。How&do&I&create&dummy&variables?
dummy variable is a variable that takes on the values 1 and 0; 1
means something is true (such as age & 25, sex is
male, or in the category “very much”).
Dummy variables are also called indicator variables.
There are three ways to create dummy variables: one is to
which creates one dumm another is to
which creates whole set and the third is to
which may allow you to avoid the issue of dummy-creation
altogether.
Answer 1 of 3: Use&generate
You could type
. gen young = 0
. replace young = 1 if age&25
. gen young = (age&25)
That statement does the same thing as the first two
statements.&age&25&is
an expression, and S returning 1 if the statement
is true and 0 if it is false.
If you have missing values in your data, it would be better if
. gen young = 0
. replace young = 1 if age&25
. replace young = . if missing(age)
. gen young = (age&25) if !missing(age)
Stata treats missing value as positive infinity, so the
expression&age&25&evaluates
to 0, not missing,
when&age&is missing. (If
the expression were&age&25,
the expression would evaluate to 1
when&age&is missing.)
You do not have to type the parentheses around the
expression.
. gen young = age&25 if !missing(age)
is good enough. Here are some more illustrations of generating
dummy variables:
. gen male = sex==1
. gen top = answer=="very much"
. gen eligible = sex=="male" & (age&55 | (age&40 & enrolled))
In the above
line,&enrolled&is itself a
dummy variable—a variable taking on values zero and one. We could
have typed&& enrolled==1,
but typing&&
enrolled&is good enough.
Just as Stata returns 1 for true and 0 for false, Stata assumes
that 1 means true and that 0 means false.
Answer 2 of 3: Use&tabulate
tabulate&with
the&generate()&option will
generate whole sets of dummy variables.
variable&group&takes on
the values 1, 2, and 3. If you type
. tabulate group
you will see a frequency table of how many times group takes on
each of those values. If you type
. tabulate group, gen(g)
you will see the table,
and&tabulate&will create
names&g1,&g2,
and&g3&that take on values
1 and 0,&g1&being 1
when&group==1,&g2&being
1 when&group==2,
and&g3&being 1
when&group==3. Watch:
. tabulate group, gen(g)
------------+-----------------------------------
------------+-----------------------------------
+----------------------+
|----------------------|
|----------------------|
+----------------------+
What you name the variable is up to you. If we had typed
. tabulate group, gen(res)
the new variables would have been
named&res1,&res2,
It is also not necessary that the variable being tabulated take
sequential values or even be integers. Here is another example:
2. | 3.14 |
. tab x, gen(xval)
------------+-----------------------------------
------------+-----------------------------------
+------------------------------+
|------------------------------|
+------------------------------+
You can find out what the values are
. describe
Contains data
55 (99.9% of memory free)
------------------------------------------------------------------------
variable name
variable label
------------------------------------------------------------------------
------------------------------------------------------------------------
Sorted by:
dataset has changed since last saved
Finally,&tabulate&can
be used with string variables:
+-----------+
|-----------|
4. | excellent |
+-----------+
. tabulate result, gen(res)
----------------+-----------------------------------
excellent |
----------------+-----------------------------------
. describe
Contains data
110 (99.9% of memory free)
------------------------------------------------------------------------
variable name
variable label
------------------------------------------------------------------------
result==bad
result==excellent
result==good
------------------------------------------------------------------------
Sorted by:
dataset has changed since last saved
+--------------------------------+
|--------------------------------|
4. | excellent
+--------------------------------+
Answer 3 of 3: Use factor variables
There are two reasons to create dummy variables. One is
convenience:
. gen eligible = sex=="male" & (age&55 | (age&40 & enrolled))
It will be more convenient and less error prone to
use&eligible&in subsequent
statements:
. list if eligible
. tabulate age if eligible
The&generate&approach
is best here.
Another reason is because you wish to fit a model with dummy
variables:
. tabulate group, gen(g)
. regress y age tenure g2 g3
Here&tabulate&is
convenient, but factor variables are even more convenient because
you could simply type
. regress y age tenure i.group
There are several factor-variable operators available in Stata
for creating indicators and interactions. For more details,
type&&or see
[U]&Factor variables.
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。&& >>
>>
>>
>> Creating dummy variables
How do I create dummy variables?
Creating dummy variables
William Gould, StataCorp
A dummy variable is a variable that takes on the values 1 and 0; 1 means
something is true (such as age & 25, sex is male, or in the category
&very much&).
Dummy variables are also called indicator variables.
As we will see shortly, in most cases, if you use factor-variable notation,
you do not need to create dummy variables.
In cases where factor variables are not the answer, you may use
to create one dummy variable at a time and
to create a set of dummies at once.
Using factor variables instead of generating dummy variables
I have a discrete variable, size, that takes on discrete values from 0 to 4
. tabulate size
------------+-----------------------------------
miniature |
------------+-----------------------------------
If I want a dummy for all levels of size except for a comparison group
or base level, I do not need to create 4 dummies. Using
, I may type
. summarize i.size
or use an estimator
. regress y x i.size
If I want to use a dummy that is 1 if size is large (size==3) and 0 otherwise, I type
. regress y x 3.size
If I want to make the comparison group, or base level, of size
be size==3 instead of the default size==0, I type
. regress y x ib3.size
You can also use factor-variable notation to refer to categorical variables,
their interactions, or interactions between categorical and continuous
variables.
For example, I can specify the interaction of each level of size
(except the base level) and the continuous variable x by typing
. regress y x i.size#c.x
The c. instructs Stata that variable x is continuous.
In all the cases above, you did not need to create a variable.
Moreover, many of Stata's postestimation facilities, including in particular
command, are aware of factor variables and will handle them
elegantly when making computations.
There are some instances where creating dummies might be worthwhile. We
illustrate these below.
to create dummy variables
You could type
. generate young = 0
. replace young = 1 if age&25
. generate young = (age&25)
This statement does the same thing as the first two statements.
age&25 is an expression, and S returning 1 if
the statement is true and 0 if it is false.
If you have missing values in your data, it would be better if you type
. generate young = 0
. replace young = 1 if age&25
. replace young = . if missing(age)
. generate young = (age&25) if !missing(age)
Stata treats a missing value as positive infinity, so the expression
age&25 evaluates to 0, not missing, when age is missing.
(If the expression were age&25, the expression would evaluate to 1
when age is missing.)
You do not have to type the parentheses around the expression.
. generate young = age&25 if !missing(age)
is good enough.
Here are some more illustrations of generating dummy
variables:
. generate male = sex==1
. generate top = answer=="very much"
. generate eligible = sex=="male" & (age&55 | (age&40 & enrolled)) if !missing(age)
In the above line, enrolled is itself a dummy variable&a
variable taking on values zero and one.
We could have typed &
enrolled==1, but typing & enrolled is good enough.
Just as Stata returns 1 for true and 0 for false, Stata assumes that 1 means
true and that 0 means false.
to create dummy variables
with the generate() option will generate whole sets
of dummy variables.
Say that variable group takes on the values 1, 2, and 3.
If you type
. tabulate group
you will see a frequency table of how many times group takes on each of
those values.
If you type
. tabulate group, generate(g)
you will see the table, and
will create variable names
g1, g2, and g3 that take on values 1 and 0, g1
being 1 when group==1, g2 being 1 when group==2, and
g3 being 1 when group==3.
. tabulate group, generate(g)
------------+-----------------------------------
------------+-----------------------------------
+----------------------+
|----------------------|
|----------------------|
+----------------------+
What you name the variable is up to you.
If we had typed
. tabulate group, generate(res)
the new variables would have been named res1, res2, and
It is also not necessary for the variable being tabulated to take sequential
values or even be integers.
Here is another example:
2. | 3.14 |
. tabulate x, generate(xval)
------------+-----------------------------------
------------+-----------------------------------
+------------------------------+
|------------------------------|
+------------------------------+
You can find out what the values are from
. describe
Contains data
55 (99.9% of memory free)
------------------------------------------------------------------------
variable name
variable label
------------------------------------------------------------------------
------------------------------------------------------------------------
Sorted by:
dataset has changed since last saved
can be used with string variables:
+-----------+
|-----------|
4. | excellent |
+-----------+
. tabulate result, generate(res)
----------------+-----------------------------------
excellent |
----------------+-----------------------------------
. describe
Contains data
110 (99.9% of memory free)
------------------------------------------------------------------------
variable name
variable label
------------------------------------------------------------------------
result==bad
result==excellent
result==good
------------------------------------------------------------------------
Sorted by:
dataset has changed since last saved
+--------------------------------+
|--------------------------------|
4. | excellent
+--------------------------------+
& Copyright
StataCorp LLC苹果/安卓/wp
积分 315, 距离下一级还需 135 积分
权限: 自定义头衔, 签名中使用图片
道具: 彩虹炫, 涂鸦板, 雷达卡, 热点灯, 金钱卡, 显身卡, 匿名卡下一级可获得
道具: 抢沙发
购买后可立即获得
权限: 隐身
道具: 金钱卡, 彩虹炫, 雷达卡, 热点灯, 涂鸦板
开心签到天数: 21 天连续签到: 1 天[LV.4]偶尔看看III
在STATA中,如何将分类变量转变为虚拟变量,求编程语句
如:分类变量:地区area:west(area=1) 、east(area=2)、middle(area=3)
现在我这样做对吗?(比较笨,但不晓得对不对)
gen west=0
replace west=1 if area==1
gen east=0
replace east=1 if area==2
gen middle=0
replace middle=1 if area==3
支持楼主:、
购买后,论坛将把您花费的资金全部奖励给楼主,以表示您对TA发好贴的支持
载入中......
stata中生成虚拟变量,dummy variables 不需要单独生成,直接在model命令里,在要生成虚拟变量的变量前加i.就可以了。如
logit y x1 i.x2
x2就生成了虚拟变量。这样在数据中并没有真正生成新的变量,只是memory里有。如果想它生成新的变量,则要在模型前加上xi:
xi:logit y x1 i.x2
热心帮助其他会员
总评分:&论坛币 + 30&
raymondxiang 发表于
stata中生成虚拟变量,dummy variables 不需要单独生成,直接在model命令里,在要生成虚拟变量的变量前加i. ...哦,原来如此简单,那我原来的岂不是错了。
意思就是我在回归时:logit y i.area&&
或者 xi: logit y x1 i.area 即可?
raymondxiang 发表于
stata中生成虚拟变量,dummy variables 不需要单独生成,直接在model命令里,在要生成虚拟变量的变量前加i. ...但是这样默认为变量X里面的第一个即为对照值,但是如果X取1,2,3,4,5,我想让第三个为对照值该怎么办
leejs 发表于
但是这样默认为变量X里面的第一个即为对照值,但是如果X取1,2,3,4,5,我想让第三个为对照值该怎么办那就在变量前面写上bx就可以了, 比如以X2的第2个值为参照组,就xi:logit y X1 ib2.X2;
如果以X2的第3个值为参照组,就xi:logit y X1 ib3.X2;
具体你可以参考stata里面help factor variables, see basic examples.
本帖最后由 蓝色 于
12:38 编辑
这几种方法都可以,都没有错误,你自己的方法,很直观,容易理解啊。想以哪个为参考值就不放那个就可以。
看你自己软件掌握的熟练程度和对理论掌握的情况
热心帮助其他会员
总评分:&论坛币 + 10&
raymondxiang 发表于
stata中生成虚拟变量,dummy variables 不需要单独生成,直接在model命令里,在要生成虚拟变量的变量前加i. ...谢谢~~
初级热心勋章
初级热心勋章
初级信用勋章
初级信用勋章
初级学术勋章
初级学术勋章
中级学术勋章
中级学术勋章
中级热心勋章
中级热心勋章
中级信用勋章
中级信用勋章
高级热心勋章
高级热心勋章
高级信用勋章
高级信用勋章
无限扩大经管职场人脉圈!每天抽选10位免费名额,现在就扫& 论坛VIP& 贵宾会员& 可免费加入
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
如有投资本站或合作意向,请联系(010-);
邮箱:service@pinggu.org
投诉或不良信息处理:(010-)
京ICP证090565号
论坛法律顾问:王进律师

我要回帖

更多关于 手机淘宝怎么关闭声音 的文章

 

随机推荐