- 博客(181)
- 资源 (10)
- 收藏
- 关注
转载 proc glm vs proc reg
1.0 Introduction to Regression Procedures in SAS Statistical ProcedureFunctionsREGperforms linear regression with many diagnostic capabilities, selects models using
2012-04-20 14:26:28 6218
原创 提取数据的变量信息content
proc contents 可以用来提前数据的一些信息,利用ods trace on语句可以检查代码运行结果的细节,找到生成变量数据并将其输出。ods trace on;proc contents data=sashelp.class; ods output variables=need;run;ods trace off;熟悉proc contents语句的,也可以一
2012-04-20 14:23:25 3220
原创 proc g3d VS scatterplot3d (R)
1.SAS的G3D语句,其语法:PROC G3D input-data-set>annotate-data-set> libref.>output-catalog>; PLOT plot-requestoption(s)>; SCATTER plot-requestoption(s)>;例如:proc g3
2012-04-19 09:23:56 1576
原创 missing函数
missing()函数是用来检验缺失值的函数帮助文档里有个例子,它是用来检查包含缺失值的变量的:data _null_; input @1 var1 3. @5 var2 3.; if missing(var1) then do; put 'Variable 1 is Missing.'; end; else if m
2012-04-17 19:06:23 4159
原创 proc sql 语句中的case 表达
proc sql; select name,sex,age,weight,height, case when height> 65 then "Tall" when height else "Average Height" end as New_height from sashelp.
2012-04-16 19:50:41 4881
转载 USING SAS TO FIND THE BEST K FOR K-NEAREST-NEIGHBOR CLASSIFICATION
******(1) USE K-MEANS CLUSTERING TO FIND NEAREAST NEIGHBORS****************;proc modeclus data = sashelp.iris m = 1 k = 4 out = _test1 neighbor; var petallength petalwidth sepallength sepalwidth
2012-04-15 21:48:22 1173
转载 SAS读取含多个子表的EXCEL表
转自:http://www.nesug.org/Proceedings/nesug11/cc/cc17.pdf该文主要应用proc sql将字表文件名赋予宏变量,然后循环读取字表中的变量名。%macro xlread; /**Assign a libname for excel sheet*/ LIBNAME XLSLIB "C:\NESUG-2011\Metabolite
2012-04-13 19:32:51 4522
转载 GLMSELECT Procedure
FROM http://support.sas.com/rnd/app/papers/glmselect.pdfThe GLMSELECT procedure performs effect selection in the framework of general linear models. A variety ofmodel selection methods are availab
2012-04-11 11:39:56 1896
原创 带误差区间图
google到很多资源,整理如下:一.sas HILOCTJ interpolation1.1 proc gplot gchart等a.support.sas官网的例子:带误差线的均值图http://support.sas.com/kb/42/515.htmlb.几篇文章“A Generalized Procedure to Create SAS®/Graph Er
2012-04-10 11:34:40 2093
翻译 SAS的DM 命令
它的语法结构很简单:DM 'command(s)' ;窗口可以是编辑窗口edit,记录窗口log,或者,输出窗口output.'command(s)'命令必须在引号' '里面,如果是几条命令则必须用分号;隔开即DM语句运行后在执行的SAS语句。简单应用:dm 'flsvlast'; *保存代码;dm 'log; clear; output; clear;'; *清除
2012-04-07 16:00:49 7178
原创 SAS dictionary工具
*得到库信息;proc sql; select * from dictionary.dictionaries;quit;*获取查询表名;proc sql; select unique memname from dictionary.dictionaries;quit;*or;proc sql; select memname from dictio
2012-04-06 20:45:30 1723
转载 消费信用中的漏斗图
"Application of SAS to monitoring loan defaults in consumer credit portfolios“libname maps 'D:\Program Files\SAS\SASFoundation\9.2\maps\'; libname temp 'D:\temp\sas Temporary Files';/* Resetti
2012-04-04 21:47:28 1179
转载 PROC SQL中的逻辑判别和描述性统计函数
1.逻辑表达:>,*data step;data class_flags; set sashelp.class; tall = (height > 60); male = (sex = 'M'); female = (sex = 'F');run;*proc sql;proc sql; select name, (
2012-04-04 19:59:27 2350
转载 SGplot画图样例
*Grouping a Scatter Plot;proc sgplot data=sashelp.class; scatter x=height y=weight / group=sex;run;*Plotting Three Series;proc sgplot data=sashelp.stocks (where=(date >= "01jan2000"d and
2012-04-03 21:26:40 9613
转载 R Graphics Basics: Plot area, mar (margins),oma (outer margin area),mfrow, mfcol (multiple figures)
http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htmPurposeThis technote explains how to use certain R graphics parameters that deal with margins, namelymar and oma. T
2012-03-02 16:20:37 1884
转载 R code to the plot the bias, variance, and MSE for the beta/binomial model
http://www4.stat.ncsu.edu/~reich/st740/MSEplots.R MSEplot<-function(n,a,b,plot.type="mse"){ #This function assumes the model y~binom(n,p); p ~ beta(a,b) #and compares the bias, variances, an
2012-02-28 13:56:02 1562
转载 杰弗里斯对归纳推理理论的规则
回忆一下归纳中最重要的部分是将过去的经验推广,来预测未来将被观测到的现象,现在来论述由杰弗里斯提出的一组管理归纳过程的规则。 规则1用到的所有假设必须是清楚叙述的,结论必须是由该假设导出的。 规则2归纳的理论必须是不矛盾的;即从假设和任何给定观测到的资料不可能引出相反的结论。 规则3给出的任何规则必须在实际中是可用的。所定义的事物在发生时可被定义所认
2012-02-22 19:35:45 1872
原创 离散先验分布
在《Bayesian computation with r》第21页,作者描绘了一离散分布图形,R代码如下:p = seq(0.05, 0.95, by = 0.1)prior = c(1, 5.2, 8, 7.2, 4.6, 2.1, 0.7, 0.1, 0, 0)prior = prior/sum(prior)plot(p, prior, type = "h", ylab="P
2012-02-20 15:33:04 726
转载 用于贝叶斯统计的R包
http://cran.r-project.org/web/views/Bayesian.html ==========一般模型==================arm包: 包括使用lm,glm,mer,polr等对象进行贝叶斯推断的R函数BACCO: 随机函数的贝叶斯分析. 包含3个子包: emulator, calibrator, and approximator, 进行贝叶
2012-01-05 20:33:35 6370
转载 R学习网址
转自:清风驿栈http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.htmlhttp://had.co.nz/ggplot2/http://addictedtor.free.fr/graphiques/http://zoonek2.free.fr/UNIX/48_R/all.html 《Statistics with R》
2011-12-30 19:45:34 3428
转载 R 基础
#======================R-demonstration script=============================#--------------------------start and quit---------------------------------Rquit()save.image() #save data, although I w
2011-12-30 19:25:02 637
原创 判别分析、logistic在信用风险评估中的应用
利用判别分析、logistic模型来分析信用风险的文章很多,这类文章应该传入国内最早的方法之一了。但是看期刊文章可以发现,作者都喜欢直接给出结果,至于如何得到结果的过程通常并不是非常的明晰。《Application of Proc Discrim and Proc Logistic in Credit Risk Modeling》一文给出SAS软件的具体操作:1.判别分析之前转载过一篇判别
2011-12-24 21:07:19 2095
原创 多元统计学习资源
传统的多元统计主要涉及多元分布与多元回归、均值向量、协方差矩阵、聚类判别、主成分与因子分析、对应分析、典型相关等等。理论学习一直都会是长期的过程,至于如何实现上述多元统计方法,推荐如下sas:http://psych.colorado.edu/~carey/Courses/PSYC7291/ExampleCode.htm,这个链接主要是用procs完成http://www.psyc
2011-12-22 22:22:49 881
转载 信用风险理论、模型及应用研究(综述)
作者:李兴法 国内外研究历史和现状一、国外研究(一)均值一方差理论综述。Harry Markowitz(1952)引入了均值一方差框架用以科学计量风险与收益问题,从而为风险的定量研究建立了数学基础。Fiseher Black和Myron Seholes(1973)推导出股票的欧式期权的价值。Robert Merton(1974)采用Black-Seholes模型解出期权的价值。Ge
2011-12-21 21:44:45 15138
原创 PROC SQL & DATA Step do the same job
sas中,很多情况下 data setp能够搞定的,proc sql也可以搞定。论坛里面经常碰到一题多解,例如汇总、重复数据、数据合并等问题。很多网友也曾作过一些汇总,且巧浏览网页时发现NESUG 2011的一篇文章总结的相当齐全,特此摘录文中例子。感兴趣的网友可以自己google,原文题目《PROC SQL for DATA Step Die-hards》,作者:Christianna S.
2011-12-19 17:22:50 2459
原创 Generating Multivariate Normal Data by Using PROC IML & R
Generating Multivariate Normal Data by Using PROC IML : http://analytics.ncsu.edu/sesug/2006/CC15_06.PDF1.Generate the bivariate normal data/* Generate the bivariate normal data */data one;m
2011-12-16 21:51:47 1482
转载 牛顿迭代例子Newton-Raphson Method
Aim: Find oˆ such thatProblem: Analytic solution of likelihood equations not always available. Example: Censored exponentially distributed observations Suppose that and that the censored time
2011-12-15 20:29:50 3742
原创 Gibbs sampling & R
维基百科的定义:http://en.wikipedia.org/wiki/Gibbs_sampling我们假设一个随机的二元变量(x,y),然后计算其中一个或全部的边缘分布p(x),p(y)。这种抽样思想是考虑条件分布p(xly),p(ylx),比通过联合密度p(xy)来计算求解简单,例如首先,我们要进行初始化y0,然后通过条件概率P(xIy=y0)计算得出x0,然后再基于x0的条
2011-12-13 21:28:19 4805 1
原创 初识EM algorithm
很多书阐述了EM algorithm的原理,直接点可以在维基百科上找到它的基本情况:http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm。EM算法分两步走即E步和M步,和很多书本和文章中一样,维基中只给出了核心结论,至于其中的数理逻辑关系并没有给出,需要探究EM算法的推导过程可以参考JerryLead
2011-12-10 21:15:36 765
原创 iml数据的处理和输入输出
之前在“IML 编程的基本函数概况”博文中有过简单的概述,这里的例子更详尽。http://www.stat.ucl.ac.be/SMCS/serveur/SAS/samples/iml/samp_iml.htmlods html body='datademo.html' ; run ; /*--create filename for class data--*/%macro fil
2011-12-09 21:05:14 1197
原创 一个Statistical Computing主页
#Plotting in preparation for the ImpSamp function. Suggests ideal g* would be an unusual distributionx=seq(-3,3,by=.1)gx=sqrt(abs(x/(1-x)))*dt(x,5)plot(x,gx,type="l")lines(x,dt(x,5),lty=2,col
2011-12-06 22:07:01 733
原创 SAS读取复杂的csv文件
最初接触读取excel文件时候,学习过几种简单的读取方式,见: http://blog.csdn.net/yugao1986/article/details/6359406但最近接触了一些稍微复杂的数据,再简单无变化的调用前面讲到的方法,发现sas总是报错。自己摸索了下,总结两条:首先,数据形式大致形如下面两种情况: 1.方法来自《Reading Delimited Text
2011-12-05 19:22:56 9524
原创 利用filename and pipe读取文件
最近在网上看到一些关于批量读取文件的帖子,想到今后定会遇到,特作记录。一.Filename1.filename function语法a.FILENAME(fileref )帮助文档里面有着经典的例子:**Example 1: Assigning a Fileref to an External File ;%let filrf=myfile;%let rc=%sy
2011-12-03 14:16:26 12468 1
转载 CALL SYMPUT Routine
CALL SYMPUT(macro-variable,value);macro-variable can be one of the following items:a character string that is a SAS name, enclosed in quotation marks. For example, to assign the
2011-12-01 20:06:19 2340
原创 分类数据的可视化(mosaic)
谢益辉的《现代统计图形》的电子版在网络上已经受到欢迎并流行开来,国内统计图形方面的书并不多见,这本书算是填补一点空白。我对书中马赛克图形的颇感兴趣,闲来无事便也翻阅了一些文献,发现Michael Friendly做了大量的研究工作。下面是主要基于R和SAS软件的研究简记。1.“Advances in Visualizing Categorical Data Using the vcd,gnm
2011-11-29 22:06:02 3792 1
转载 One-Step Change from Baseline Calculations
data test; input usubjid visitc $10. visitn hr; cards;1 Screening 1 911 Day 2 .1 Week 1 3 681 Week 2 4 731 Week 4 5 962 Screening 1 .2 Day 1 2 732 Wee
2011-11-25 22:33:20 719
转载 R Graph Cookbook 代码(chapter5-10)
#CHAPTER 5#Recipe 1. Creating Bar charts with more than one factor variableinstall.packages("RColorBrewer") #if not already installedlibrary(RColorBrewer) citysales<-read.csv("citysales.c
2011-11-23 22:25:11 2361
转载 R Graph cookbook代码(chapter 1-4)
#CHAPTER 1#Recipe 1. Creating scatter plotsplot(cars$dist~cars$speed)plot(cars$dist~cars$speed, # y~xmain="Relationship between car distance & speed", #Plot Titlexlab="Speed (miles per hour)
2011-11-23 22:17:33 3036 1
转载 Safely Merging Many Datasets
FromINTRODUCTIONIt is a well-documented behavior that when SAS merges two datasets that share a common variable name, the values of the later variable overwrite those of the former. Consequently,
2011-11-22 10:46:40 662
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人