427 0

求翻译 [推广有奖]

  • 0关注
  • 0粉丝

小学生

0%

还不是VIP/贵宾

-

威望
0
论坛币
10 个
通用积分
1.0702
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
33 点
帖子
4
精华
0
在线时间
0 小时
注册时间
2019-12-16
最后登录
2019-12-16

楼主
皮卡丘的皮皮虾 发表于 2019-12-16 15:32:56 来自手机 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
Statatip2:Buildingwithfoorsandceilings<br>
NicholasJ.Cox,UniversityofDurham,UK<br>
n.j.cox@durham.ac.uk<br>
Didyouknowaboutthefloor()andceil()functionsaddedinStata8?<br>
Supposethatyouwanttorounddowninmultiplesofsomefixednumber.<br>
For<br>
concreteness,say,youwanttoroundmpgintheautodatainmultiplesof5sothatany<br>
values10–14getroundedto10,anyvalues15–19to15,etc.mpgissimple,inthat<br>
onlyintegervaluesoccur;inmanyothercases,weclearlyhavefractionalpartstothink<br>
aboutaswell.<br>
Hereisaneasysolution:5*floor(mpg/5).floor()alwaysroundsdowntothe<br>
integerlessthanorequaltoitsargument.ThenamefloorisduetoIverson(1962),the<br>
principalarchitectofAPL,whoalsosuggestedtheexpressivexnotation.Forfurther<br>
discussion,seeKnuth(1997,39)orGraham,Knuth,andPatashnik(1994,chapter3).<br>
Asithappens,5*int(mpg/5)givesexactlythesameresultformpgintheauto<br>
data,butingeneral,whenevervariablesmaybenegativeaswellaspositive,interval*<br>
floor(expression/interval)givesamoreconsistentclassification.<br>
Letuscomparethisbrieflywithotherpossiblesolutions.round(mpg,5)isdifferent,<br>
asthisroundstothenearestmultipleof5,whichcouldbeeitherroundinguporrounding<br>
down.round(mpg-2.5,5)shouldbefinebutisalsoalittletoomuchlikeadodge.<br>
Withrecode(),youneedtwododges,say,-recode(-mpg,-40,-35,-30,-25,-20,<br>
-15,-10).Noteallthenegativesigns;negatingandthennegatingtoreverseitare<br>
necessarybecauserecode()usesitsnumericargumentsasupperlimits;i.e.,itrounds<br>
up.<br>
egen,cut()offersanothersolutionwithoptioncallat(10(5)45).Beingableto<br>
specifyanumlistisnice,ascomparedwithspellingoutacomma-separatedlist,butyou<br>
mustalsoaddalimit,here45,whichwillnotbeused;otherwise,withat(10(5)40),<br>
yourhighestclasswillbemissing.<br>
YutakaAokialsosuggestedtomempg-mod(mpg,5),whichfollowsimmediately<br>
onceyouseethatroundingdownamountstosubtractingtheappropriateremainder.<br>
mod(,),however,doesnotofferacorrespondinglyneatwayofroundingup.<br>
Thefloorsolutiongrowsonone,andithasthemeritthatyoudonotneedtospell<br>
outallthepossibleendvalues,withtheriskofforgettingormistypingsome.Conversely,<br>
recode()andegen,cut()arenotrestrictedtoroundinginequalintervalsandremain<br>
usefulformorecomplicatedproblems.<br>
Withoutrecapitulatingthewholeargumentinsofarasitappliestoroundingup,<br>
floor()’ssiblingceil()(shortforceiling)givesanicewayofroundingupinequal<br>
intervalsandiseasiertoworkwiththanexpressionsbasedonint().
二维码

扫码加我 拉你入群

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

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


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

本版微信群
jg-xs1
拉您进交流群
GMT+8, 2025-12-28 20:17