




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、SPSS11.0講義-數(shù)據(jù)準(zhǔn)備一、 安裝SPSS11.0二、 運(yùn)行SPSS及窗口元素菜單欄工具條主窗口區(qū)記錄數(shù)變量名三、 轉(zhuǎn)入數(shù)據(jù)選擇“File”“Open”“Data”。數(shù)據(jù)轉(zhuǎn)入后的數(shù)據(jù)窗口和變量窗口結(jié)果輸出窗口命令句:GET TRANSLATE FILE=E:FileTeach專業(yè)計(jì)算機(jī)應(yīng)用phy.DBF /TYPE=DBF /MAP .四、 數(shù)據(jù)的預(yù)處理:菜單中的Data和Transform1. 插入變量Insert Variable,插入記錄Insert Case:2. 快速跳轉(zhuǎn)的記錄Go to Case3. 數(shù)據(jù)排序Sort Cases(Ascending/Descending)命令
2、句:SORT CASES BY no (A) birthday (A) .4. 行列轉(zhuǎn)置Transpose是將行轉(zhuǎn)換為列,同時(shí)將列轉(zhuǎn)換為行,一般情況下很少用到。5. 合并數(shù)據(jù)Merge Files是縱向或橫向合并數(shù)據(jù)文件1) 縱向合并Add Cases:File1.savnogenderbirthdaynation6246男性27-Dec-01漢族File2.savnogenderbirthdaynation6247女性27-Dec-01漢族File12.savnogenderbirthdaynation6246男性27-Dec-01漢族6247女性27-Dec-01漢族命令句:ADD FIL
3、ES /FILE=* /FILE=E:FileTeach專業(yè)計(jì)算機(jī)應(yīng)用file2.sav.EXECUTE.2) 橫向合并Add Variables:File1.savnogenderbirthdaynation6245男性26-Dec-01漢族6246男性27-Dec-01漢族6247女性27-Dec-01漢族File3.savnobwtbht624534505062462650486247335549File13.savnogenderbirthdaynationbwtbht6245男性26-Dec-01漢族3450506246男性27-Dec-01漢族2650486247女性27-Dec-
4、01漢族335549命令句:MATCH FILES /FILE=* /FILE=E:FileTeach專業(yè)計(jì)算機(jī)應(yīng)用file3.sav/BY noEXECUTE.6. 選擇記錄Select Cases進(jìn)行統(tǒng)計(jì)分析命令句:USE ALL.COMPUTE filter_$=(gender = 男性).VARIABLE LABEL filter_$ gender = 男性 (FILTER).VALUE LABELS filter_$ 0 Not Selected 1 Selected.FORMAT filter_$ (f1.0).FILTER BY filter_$.EXECUTE .7. 指定權(quán)重
5、變量Weight Case命令句:WEIGHT BY laymany .8. 計(jì)算新變量值Compute命令句:COMPUTE week2 = SUBSTR(layweek,1,4) .EXECUTE .COMPUTE語句中需要用到的函數(shù)Arithmetic functions:ABS(arg) Absolute valueRND(arg) RoundTRUNC(arg) TruncateMOD(arg) ModulusSQRT(arg) Square rootEXP(arg) ExponentialLG10(arg) Base 10 logarithmLN(arg) Natural loga
6、rithmARSIN(arg) ArcsineARTAN(arg) ArctangentSIN(arg) SineCOS(arg) CosineStatistical functions:SUM.n(arg list) Sum of values across argument listMEAN.n(arg list) Mean value across argument listSD.n(arg list) Standard deviation of values across listVAR.n(arg list) Variance of values across listCFVAR.n
7、(arg list) Coefficient of variation of values across listMIN.n(arg list) Minimum value across listMAX.n(arg list) Maximum value across listCumulative distribution functions (continuous):CDF.BETA(q,a,b) Return probability that the beta random variate falls below q (0q1; a0; b0).CDF.CAUCHY(q,a,b) Retu
8、rn probability that the Cauchy random variate falls below q (q0; b0).CDF.CHISQ (q,a) Return probability that the chi-square random variate falls below q (q0; a0).CDF.EXP(q,a) Return probability that the exponential random variate falls below q (q0; a0).CDF.F(q,a,b) Return probability that the F rand
9、om variate falls below q (q0; a0; b0).CDF.GAMMA(q,a,b) Return probability that the gamma random variate falls below q (q0; a0; b0).CDF.LAPLACE(q,a,b) Return probability that the Laplace random variate falls below q (b0).CDF.LOGISTIC(q,a,b) Return probability that the logistic random variate falls be
10、low q (b0).CDF.LNORMAL(q,a,b) Return probability that the lognormal random variate falls below q (q0; b0).CDF.NORMAL(q,a,b) Return probability that the normal random variate falls below q (b0). When a=0, b=1, alias CDFNORM(q).CDF.PARETO(q,a,b) Return probability that the Pareto random variate falls
11、below q (qa0; b0).CDF.T(q,a) Return probability that the Student t random variate falls below q (a0).CDF.UNIFORM(q,a,b) Return probability that the uniform random variate falls below q (aqb).CDF.WEIBULL(q,a,b) Return probability that the Weibull random variate falls below q (q0; a0; b0).Inverse dist
12、ribution functions (continuous):IDF.BETA(p,a,b) Return value q such that CDF.BETA(q,a,b)=p (0p1; a0; b0).IDF.CAUCHY(p,a,b) Return value q such that CDF.CAUCHY(q,a,b)=p (0p0).IDF.CHISQ(p,a) Return value q such that CDF.CHISQ(q,a)=p (0p0).IDF.EXP(p,a) Return value q such that CDF.EXP(q,a)=p (0p0).IDF.
13、F(p,a,b) Return value q such that CDF.F(q,a,b)=p (0p0; b0).IDF.GAMMA(p,a,b) Return value q such that CDF.GAMMA(q,a,b)=p (0p0; b0).IDF.LAPLACE(p,a,b) Return value q such that CDF.LAPLACE(q,a,b)=p (0p0).IDF.LOGISTIC(p,a,b) Return value q such that CDF.LOGISTIC(q,a,b)=p (0p0).IDF.LNORMAL(p,a,b) Return
14、value q such that CDF.LNORMAL(q,a,b)=p (0p1; b0).IDF.NORMAL(p,a,b) Return value q such that CDF.NORMAL(q,a,b)=p (0p0). When a=0, b=1, alias PROBIT(p).IDF.PARETO(p,a,b) Return value q such that CDF.PARETO(q,a,b)=p (0p0; b0).IDF.T(p,a) Return value q such that CDF.T(q,a)=p (0p0).IDF.UNIFORM(p,a,b) Ret
15、urn value q such that CDF.UNIFORM(q,a,b)=p (0p1; ab).IDF.WEIBULL(p,a,b) Return value q such that CDF.WEIBULL(q,a,b)=p (0p0; b0).Random variable functions (continuous distributions):RV.BETA(a,b) Generate a random variable of the beta distribution (a0; b0).RV.CAUCHY(a,b) Generate a random variable of
16、the Cauchy distribution (b0).RV.CHISQ(a) Generate a random variable of the chi-square distribution (a0).RV.EXP(a) Generate a random variable of the exponential distribution (a0).RV.F(a,b) Generate a random variable of the F distribution (a0; b0).RV.GAMMA(a,b) Generate a random variable of the gamma
17、distribution (a0; b0).RV.LAPLACE(a,b) Generate a random variable of the Laplace distribution (b0).RV.LOGISTIC(a,b) Generate a random variable of the logistic distribution (b0).RV.LNORMAL(a,b) Generate a random variable of the lognormal distribution (b0).RV.NORMAL(a,b) Generate a random variable of t
18、he normal distribution (b0). When a=0, alias NORMAL(b).RV.PARETO(x,a,b) Generate a random variable of the Pareto distribution (b0).RV.T(a) Generate a random variable of the Student t distribution (b0).RV.UNIFORM(a,b) Generate a random variable of the uniform distribution. When a=0, alias UNIFORM(b).
19、RV.WEIBULL(a,b) Generate a random variable of the Weibull distribution (a0; b0).Cumulative distribution functions (discrete):CDF.BERNOULLI(q,a) Return probability that the Bernoulli distributed variate is less than or equal to q (q=0 or 1 only, 0a1).CDF.BINOM(q,a,b) Return probability that the binom
20、ially distributed variate is less than or equal to q (0qa integer, 0b1).CDF.GEOM(q,a) Return probability that the geometrically distributed variate is less than or equal to q (q0 integer; 00 integer, 0ca, 0ba; max(0,ba+c)qmin(c,b).CDF.NEGBIN(q,a,b) Return probability that the negative binomially dis
21、tributed variate is less than or equal to q (a0 integer, 0b1; qa integer).CDF.POISSON(q,a) Return probability that the Poisson distributed variate is less than or equal to q (a0; q0 integer).Random variable functions (discrete distributions):RV.BERNOULLI(a) Generate a random variable from the Bernou
22、lli distribution.RV.BINOM(a,b) Generate a random variable from the binomial distribution.RV.GEOM(a) Generate a random variable from the geometric distribution.RV.HYPER(a,b,c) Generate a random variable from the hypergeometric distribution (a0 integer, 0ca, 0ba).RV.NEGBIN(a,b) Generate a random varia
23、ble from the negative binomial distribution (a0 integer, 0b1).RV.POISSON(a) Generate a random variable from the Poisson distribution (a0).Noncentral distribution functions:NCDF.BETA(x,a,b,c) Return probability that the noncentral beta distributed variate falls below x(a0,b0,c0; 0x1).NCDF.CHISQ(x,a,c
24、) Return probability that the noncentral chi-square distributed variate falls below x (a0, c0; x0).NCDF.F(x,a,b,c) Return probability that the noncentral F distributed variate falls below x(a0, b0, c0; x0).NCDF.T(x,a,c) Return probability that the noncentral Student t distributed variate falls below
25、 x (a0, c0).Missing-value functions:VALUE(varname) Ignore user-missing.MISSING(varname) True if missing.SYSMIS(varname) True if system-missing.NMISS(arg list) Number of missing values across list.NVALID(arg list) Number of valid values across list.Cross-case function:LAG(varname,n) Value of variable
26、 n cases before.Logical functions:RANGE(varname,range) True if value of variable is in range.ANY(arg,arg list) True if value of first argument is included on argument list.Other functions:UNIFORM(arg) Uniform pseudo-random number between 0 and n.NORMAL(arg) Normal pseudo-random number with mean of 0
27、 and standard deviation of n.CDFNORM(arg) Probability that random variable falls below n.PROBIT(arg) Inverse of CDFNORM.Date and time aggregation functions:DATE.DMY(d,m,y) Read day, month, year, and return date.DATE.MDY(m,d,y) Read month, day, year, and return date.DATE.YRDAY(y,d) Read year, day, an
28、d return date.DATE.QYR(q,y) Read quarter, year, and return quarter start date.DATE.MOYR(m,y) Read month, year, and return month start date.DATE.WKYR(w,y) Read week, year, and return week start date.TIME.HMS(h,m,s) Read hour, minutes, seconds, and return time interval.TIME.DAYS(d) Read days and retur
29、n time interval.Date and time conversion functions:YRMODA(yr,mo,da) Convert year, month, day to day number.CTIME.DAYS(arg) Convert time interval to days.CTIME.HOURS(arg) Convert time interval to hours.CTIME.MINUTES(arg) Convert time interval to minutes.Date and time extraction functions:XDATE.MDAY(a
30、rg) Return day of the month.XDATE.MONTH(arg) Return month of the year.XDATE.YEAR(arg) Return four-digit year.XDATE.HOUR(arg) Return hour of a day.XDATE.MINUTE(arg) Return minute of an hour.XDATE.SECOND(arg) Return second of a minute.XDATE.WKDAY(arg) Return weekday number.XDATE.JDAY(arg) Return day n
31、umber of day in given year.XDATE.QUARTER(arg) Return quarter of date in given year.XDATE.WEEK(arg) Return week number of date in given year.XDATE.TDAY(arg) Return number of days in time interval.XDATE.TIME(arg) Return time portion of given date and time.XDATE.DATE(arg) Return integral portion of dat
32、e.String functions:ANY(arg,arg list) Return 1 if value of argument is included on argument list.CONCAT(arg list) Join the arguments into a string.INDEX(a1,a2,a3) Return number indicating position of first occurrence of a2 in a1; optionally, a2 in a3 evenly divided substrings of a1.LAG(arg,n) Return
33、value of argument n cases before.LENGTH(arg) Return length of argument.LOWER(arg list) Convert upper case to lower case.LPAD(a1,a2,a3) Left-pad beginning of a1 to length a2 with character a3.LTRIM(a1,a2) Trim character a2 from beginning of a1.MAX(arg list) Return maximum value of argument list.MIN(a
34、rg list) Return minimum value of argument list.NUMBER(arg,format) Convert argument into number using format.RANGE(arg,arg list) Return 1 if value of argument is in inclusive range of argument list.RINDEX(a1,a2,a3) Return number indicating rightmost occurrence of a2 in a1;optionally, a2 in a3 evenly
35、divided substrings of a1.RPAD(a1,a2,a3) Right-pad end of a1 to length a2 with character a3.RTRIM(a1,a2) Trim character a2 from end of a1.STRING(arg,format) Convert argument into string using format.SUBSTR(a1,a2,a3) Return substring of a1 beginning with position a2 for length a3.UPCASE(arg list) Conv
36、ert lower case to upper case.MBLEN.BYTE(arg,a1) Return the number of bytes for the character beginning at position a1 in the string argument. If a1 is not specified, it defaults to 1.9. 重新編碼數(shù)據(jù)Recode(Into Same Variables/Into Different Variables)命令句:RECODE week (Lowest thru 35.999=早產(chǎn)) (36 thru 42=足月)
37、(42.001 thru Highest=過期) INTO week3 .VARIABLE LABELS week3 是否足月.EXECUTE .10. 替代缺省值Replace Missing Values命令句:RMV/bwt_1=SMEAN(bwt).11. 設(shè)置缺省值命令句:MISSING VALUES gender (9,6).12. IF條件命令語句IF (logical expression) target variable=expressionThe following relational operators can be used in logical expression
38、s:The following logical operators can be used in logical expressions:Example:IF (AGE 20 AND SEX = 1) GROUP=2.OverviewIF conditionally executes a single transformation command based upon logical conditionsfound in the data. The transformation can create a new variable or modify the values of anexisti
39、ng variable for each case in the working data file. You can create or modify the valuesof both numeric and string variables. If you create a new string variable, you must first declareit on the STRING command.IF has three components: a logical expression (see “Logical Expressions” on p. 45) thatsets
40、 up the logical criteria, a target variable (the one to be modified or created), and an assignmentexpression. The target variables values are modified according to the assignmentexpression.IF is most efficient when used to execute a single, conditional, COMPUTE-like transformation.If you need multip
41、le IF statements to define the condition, it is usually more efficientto use the RECODE command or a DO IFEND IF structure.Symbol Definition Symbol DefinitionEQ or = Equal to NE or * On ASCII systems (for example, UNIX, VAX, and all PCs) you can also use =;on IBM EBCDIC systems (for example, IBM 360
42、 and IBM 370) you can also use =.Not equal toLT or Less than LE or Greater than GE or = Greater than or equal toSymbol DefinitionAND or & Both relations must be trueOr or | Either relation can be trueNot* Reverses the outcome of an expression* On ASCII systems you can also use ; on IBM EBCDIC system
43、syou can also use (or the symbol above number 6).Basic SpecificationThe basic specification is a logical expression followed by a target variable, a requiredequals sign, and the assignment expression. The assignment is executed only if the logicalexpression is true.Syntax Rules Logical expressions c
44、an be simple logical variables or relations, or complex logical testsinvolving variables, constants, functions, relational operators, and logical operators. Boththe logical expression and the assignment expression can use any of the numeric or stringfunctions allowed in COMPUTE transformations (see
45、COMPUTE and “Transformation Expressions”on p. 35). Parentheses can be used to enclose the logical expression. Parentheses can also be usedwithin the logical expression to specify the order of operations. Extra blanks or parenthesescan be used to make the expression easier to read. A relation can com
46、pare variables, constants, or more complicated arithmetic expressions.Relations cannot be abbreviated. For example, (A EQ 2 OR A EQ 5) is valid, while(A EQ 2 OR 5) is not. Blanks (not commas) must be used to separate relational operatorsfrom the expressions being compared. A relation cannot compare
47、a string variable to a numeric value or variable, or vice versa.A relation cannot compare the result of the logical functions SYSMIS, MISSING, ANY, orRANGE to a number. String values used in expressions must be specified in quotes and must include any leadingor trailing blanks. Lowercase letters are
48、 considered distinct from uppercase letters. String variables that are used as target variables must already exist. To declare a newstring variable, first create the variable with the STRING command and then specify thenew variable as the target variable on IF.Operations Each IF command evaluates ev
49、ery case in the data. Compare IF with DO IF, which passescontrol for a case out of the DO IFEND IF structure as soon as a logical condition is met. The logical expression is evaluated as true, false, or missing. The assignment is executedonly if the logical expression is true. If the logical express
50、ion is false or missing, the assignmentis not made. Existing target variables remain unchanged; new numeric variablesretain their initial (system-missing) values. In general, a logical expression is evaluated as missing if any one of the variables usedin the logical expression is system- or user-mis
51、sing. However, when relations are joinedby the logical operators AND or OR, the expression can sometimes be evaluated as trueor false even when variables have missing values (see “Missing Values and Logical Operators”on p. 542).Numeric Variables Numeric variables created with IF are initially set to
52、 the system-missing value. By default,they are assigned an F8.2 format. Logical expressions are evaluated in the following order: functions, followed by exponentiation,arithmetic operations, relations, and logical operators. When more than onelogical operator is used, NOT is evaluated first, followe
53、d by AND and then OR. You canchange the order of operations using parentheses. Assignment expressions are evaluated in the following order: functions, then exponentiation,and then arithmetic operators.String Variables New string variables declared on IF are initially set to a blank value and are ass
54、igned theformat specified on the STRING command that creates them. Logical expressions are evaluated in the following order: string functions, then relations,and then logical operators. When more than one logical operator is used, NOT is evaluatedfirst, followed by AND and then OR. You can change th
55、e order of operations using parentheses. If the transformed value of a string variable exceeds the variables defined width, thetransformed value is truncated. If the transformed value is shorter than the defined width,the string is right-padded with blanks.Missing Values and Logical OperatorsWhen two or more relations are joined by logical operators AND or OR, the program alwaysreturns a missing value if all of the relations in the expression are missing. However, if anyone of the relations can be determined, the program interprets the exp
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 修路材料采購合同范例
- 單位施工合同范本
- 單位補(bǔ)合同范本
- 高壓電工(運(yùn)行)題庫及答案
- 印刷加工采購合同范例
- 買商鋪 合伙 合同范本
- 與企業(yè)簽訂合同范本模板
- 句容未公示合同范本
- 醫(yī)療糾紛合同范本
- 《繁星春水》讀書心得體會(huì)
- 《綠色建筑設(shè)計(jì)原理》課件
- 中醫(yī)館裝修合同范本
- 學(xué)習(xí)與科技的融合主題班會(huì)
- 《直播銷售》課件-項(xiàng)目一 認(rèn)識(shí)直播與直播銷售
- 2025年南京科技職業(yè)學(xué)院高職單招數(shù)學(xué)歷年(2016-2024)頻考點(diǎn)試題含答案解析
- 2025-2030年中國航空配餐行業(yè)市場(chǎng)發(fā)展現(xiàn)狀及投資前景規(guī)劃研究報(bào)告
- 新課標(biāo)背景下的跨學(xué)科學(xué)習(xí)內(nèi)涵、設(shè)置邏輯與實(shí)踐原則
- 母嬰分離產(chǎn)婦的護(hù)理
- 2025年全國高考體育單招政治時(shí)事填空練習(xí)50題(含答案)
- 2025教科版一年級(jí)科學(xué)下冊(cè)教學(xué)計(jì)劃
- 人教版高一上學(xué)期數(shù)學(xué)(必修一)期末考試卷(附答案)
評(píng)論
0/150
提交評(píng)論