sas线性回归分析案例(Case study of SAS linear regression analysis).doc_第1页
sas线性回归分析案例(Case study of SAS linear regression analysis).doc_第2页
sas线性回归分析案例(Case study of SAS linear regression analysis).doc_第3页
sas线性回归分析案例(Case study of SAS linear regression analysis).doc_第4页
sas线性回归分析案例(Case study of SAS linear regression analysis).doc_第5页
已阅读5页,还剩44页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、sas线性回归分析案例(Case study of SAS linear regression analysis)linear regression20094788 Chen Lei calculates 2Southwest Jiao Tong UniversitySouthWest JiaoTong University-Linear regression is divided into single linear regression and multiple linear regression.The model of unary linear regression isY=.0+.1

2、X+ epsilon,HereXIndependent variable,YDependent variable,Epsilon is a random error term.It is usually assumed that the mean of the random error isZeroThe variance is(.2.20),.2 andXValue independent. If further assumptionsRandom errorThe difference follows a normal distribution, which is called a nor

3、mal linear model. In general, withKAn independent variable and a dependent variable, dependent variableThe value can be broken down into two parts: part is due to the influence of the independent variable, that is to sayFunction as an argumentAmong them, the function form is alreadyKnow, but contain

4、 some unknown parameters; another part is due to other UN considered factors and random effects, that is, random errors.When a function is a linear function of unknown parameters, it is called a linear regression analysis model.If there are multiple dependent variables, the regression model is:Y=.0+

5、.1X1+.2X2+.+.IXi+.Due to the linear dieThe model contains random errors, so the regressionThe straight line reflected by the model is uncertain. The main purpose of regression analysis is to derive from theseIn the uncertain straight line, find a line which can best fit the original data information

6、 and describe it as a regression modelRelationship between independent variables,The straight line is called the regression equation.throughOften in regression analysis, yesEpsilon has the most commonly used classical assumptions.1. The expected value of epsilon isZero2, epsilon for allXFor example,

7、 it has the same variance.3, epsilon obeys normal distribution and is independent of each otherVariable.Explanation of linear regression,This paperBased on examples.In the following example, there is a one element regression analysis, and another twoMeta regression analysis.Examples(Data analysis me

8、thod_exercises2.4_page79)A company manager who knows about the monthly sales of a cosmetics in a cityY(unit: box) with the middle of the cityThe number of people who use the cosmetics.1 (unit: thousand persons) and their per capita monthly income.2 (unit: yuan) betweenIn a certain monthFifteenThree

9、cities were surveyed to obtain the above viewsMeasured values, such as tableTwo point one twoAs shown.surfaceTwo point one twoCosmetics sales dataCitySales volume (y)Number of people (x1)Income (x2)CitySales volume (y)Number of people (x1)Income (x2)OneOne hundred and sixty-twoTwo hundred and sevent

10、y-fourTwo thousand four hundred and fiftyNineOne hundred and sixteenOne hundred and ninety-fiveTwo thousand one hundred and thirty-sevenTwoOne hundred and twentyOne hundred and eightyThree thousand two hundred and fifty-fourTenFifty-fiveFifty-threeTwo thousand five hundred and sixtyThreeTwo hundred

11、and twenty-threeThree hundred and seventy-fiveThree thousand eight hundred and twoElevenTwo hundred and fifty-twoFour hundred and thirtyFour thousand and twentyFourOne hundred and thirty-oneTwo hundred and fiveTwo thousand eight hundred and thirty-eightTwelveTwo hundred and thirty-twoThree hundred a

12、nd seventy-twoFour thousand four hundred and twenty-sevenFiveSixty-sevenEighty-sixTwo thousand three hundred and forty-sevenThirteenOne hundred and forty-fourTwo hundred and thirty-sixTwo thousand six hundred and sixtySixOne hundred and sixty-nineTwo hundred and sixty-fiveThree thousand seven hundre

13、d and eighty-twoFourteenOne hundred and threeOne hundred and fifty-sevenTwo thousand and eighty-eightSevenEighty-oneNinety-eightThree thousand and eightFifteenTwo hundred and twelveThree hundred and seventyTwo thousand six hundred and fiveEightOne hundred and ninety-twoThree hundred and thirtyTwo th

14、ousand four hundred and fiftyhypothesisYand.1,Linear regression relation is found between.2.=.0+.1.1+.2.2+.,.=1,2,. 15.amongIndependent and identically distributed. (0,.2)(One)Coefficient of linear regression.0,.1,Least squares estimation and error variance of.2.2 estimates, writes regression equati

15、ons, and.Regression coefficientInterpret;(Two)The ANOVA table was used to explain the significance of linear regression test. Square of the coefficient of the complex correlation.2valueAnd explain its meaning;(Three)Separately seek.1 andThe confidence of.2 is95%Confidence interval;(Four)YesThe numbe

16、r of people tested by alpha =0.05.1 and income.2Sales volumeYIs the effect significant?Regression coefficientTest of general hypothesis test method.1 andThe interaction of.2 (i.e.1.2) yesYIs the effect significant?;Data importEdit window inputThis questionTheData import code:TitleData analysis metho

17、d_exercises2.4_page79; / *Title, omission does not affect analysis results* /DataMylib.ch2_2_4;*First, a new logical library,Logical LibrariesMylibCreate data setCh2_2_4*/Input y X1 x2 /*;Represents a continuous input,YDependent variable,X1,X2Independent variable* /Cards; / *Start input data* /16227

18、42450120180, 32542233753802131205283867862347, 1692653782819830081923302450, 1161952137Fifty-five532560252430402023, 37244271442362660103157, 20882123702605;*Missing data.Otherwise, the corresponding set of data will be automatically deleted* /Run/*runStatement is used to illustrate all rows before

19、the statement in the current procedure step* /PressF8After run,Open logical libraryMylibYou can see the new data setCh2_2_4.SASA variety of imports are providedAccording to the manner, for example:One,Read data from file,INFILEF:MylibCH2_2_4.txt;TwoAnd the use of established data sets,Proc reg data=

20、mylib.ch2_2_4;You can also import directly from outsideExcelOther ways. The program above is entered directly in the edit cedure callThe procedure to call in this questionyesProc regProcess.Proc regProcess isSASsystemMany regression analysis process of the system in theExcept that it can fit

21、the general linear regression model,A variety of optimal model selection methods and model checking methods are also provided.Among themOne)Two)ThreeThe results of multivariate linear regression analysis are mainly used. (Four) will use a linear regression analysisResults.(I)Yand.,Linear regression

22、analysisProcReg;*transferRegProcess use* /MOdel y=x1 x2;*Dependent variableYThe independent variable isX1,X2*/Run;ModelStatement: used to define the models dependent variables, arguments, model options, and output options.Common options areSelection=,Specifies the variable selection method:FORWARD(f

23、orward input method),BACKWARDXiang HoushanDivision),STEPWISE(stepwise regression),ADJRSQ(modified multiple correlation coefficient criterion),CP(Cp criterionEtc.NOINTSaid, is often included in the modelNumber item;STBThe regression coefficient, output standard;CLIThe output of single predictive valu

24、e, confidence interval;RResidual scores are performedAnalysis of results of the analysis and output;IOutput(XTX).1matrix.Format:MODELDependent variable name=Argument rankingTheseoptionCases:Model y=x1 / x2 selection=stepwise / *;stepwise regression* /After running the program, get the resultsParamet

25、er estimation table(One)Least squares estimation:= = (0,. 1,. 2) = (3.45261,0.49600,0.00920)Regression equation:Y=3.45261+0.49600.1+0.00920.2ANOVA table(TwoError variance estimate:. 2=MSE=4.74040Multiple correlation coefficientSquares:.2=0.9989(R-Square)Significance: from the value of the complex co

26、rrelation coefficient, it can be seen that it is highly significantYand.1,.2)Multiple correlation coefficientSquaresCan also passBy calculation:.2=SSR/SST=53845/53902=0.9989(Three)Confidence interval:K+.t1.2 (N.P) s.).0.975 (12) =2.17881 (via check)T distribution table obtained)You can also pass the

27、 functionY=TINV(P,DFObtain.1=0.496+/-2.179*0.00605Draw (Zero point four eight two eight,Zero point five zero nine two).2=0.0092+/-2.179*0.00096811,DrawZero point zero zero seven one,Zero point zero one one three)(Two)YandLinear regression analysisProcRegData=mylib.ch2_2_4; / *Direct reference data s

28、et* /Model y=x1;Run;(FourThe coefficient of multiple correlation is:Zero point nine nine one zero,X1YesYSignificant influence(Three)YandLinear regression analysisProcRegData=mylib.ch2_2_4; / *Direct reference data set* /Model y=x2;Run;(Four)The coefficient of quadratic correlation is square:Zero poi

29、nt four zero eight seven,X2YesYThe effect is not significant(Four)YandLinear regression analysis of.Data mylib.ch2_2_4;Set mylib.ch2_2_4;*Read data set* /Z=x1*x2;*New argumentZ*/Run;Proc reg;Model y=z;*Argument isZ*/Run;(Four)The square of the complex correlation coefficient is:Zero point nine zero

30、three zero,X1X2YesYSignificant impactLinear regression analysis using modules(I)Linear regression analysisstart-upSASSystem, and click solution in turn-Analysis-AnalystsAnd then click file-Open, open the data setCh2_2_4.sas7bdat,FigureVariable listindependent variabledependent variableThe value of c

31、onfidence aClick Statistics in turn-Regression-Simple pop-up dialog box(One)Variable settingsOn the left hand side of the variableslistCentral ElectionYClickDependentThe button is set as dependent variable;SelectedX2ClickExplanatoryButton, set it as an argument.ModelIn the settings bar, select by de

32、faultLinear means linear regression.(Two)TestsSet upClickTestsButton to eject the dialog boxConfidence defaults toZero Point Zero FiveMay change.ClickOK.(Three)PlotsSet upClickPlotsButton pops up the plotting Options dialog boxChoiceResidulTab.StudentizedRepresents a student residual,Normal quantile

33、-Quantile plotStands for normality.QQGraph check.Settings as shownResidual columnNormal inspectionTest barVariable columnvariance analysisparameter estimationClickOKAnd click on the main settings dialog boxOK,ThereforeAnd get resultsregression equationClickAnalysis (new, project)Dialog boxPlot of RSTUDENTVsX2 pops up the residual graphDialog boxClick againPlot of RSTUDENTVsNQQPop upQQchartThe normal state of the residual by the studentQQIt can be seen that the model

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论