99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
首頁精彩閱讀R語言單元變量的數(shù)據(jù)可視化方法
R語言單元變量的數(shù)據(jù)可視化方法
2016-02-17
收藏

R語言單元變量的數(shù)據(jù)可視化方法

Uni-variate data  一元變量的數(shù)據(jù)分析方法
點圖dot plot與抖動圖jitter plot
當(dāng)點都重疊在一起的時候,為了更直觀分析數(shù)據(jù)分布情況,可以把點適當(dāng)抖動到一定位置(適量的偏移)。
下面這個例子,由于x的值是我們要觀測的,所以在y上進(jìn)行抖動。不可以在x上抖動,因為x是觀測對象。
一個tip:空心圓圈,是最容易識別的圖形。填充的圖形造成難以識別內(nèi)部結(jié)構(gòu),而線(框或叉)在數(shù)據(jù)量大的時候往往難以識別。
數(shù)據(jù)文件 presidents.txt
[java] view plain copy
 print?在CODE上查看代碼片派生到我的代碼片
presidents <- read.fwf("presidents.txt", widths = c(9, 15, 3), col.names = c("id","name","months"))  
  
with(  
  data=presidents,   
   {  
    plot(months, rep(2.5, length(months)),  
         main = "dot plot and jitter plot",  
         xlab = "months", ylab = "",  
         pch = 15, col = "blue",   
         xlim = c(0, 150), ylim=c(0, 3))  
      
    points(months, jitter(rep(1.5, length(months)), 20), col = "black")  
    })  

柱狀圖 Histogram
柱狀圖用于分析單元數(shù)據(jù)的分布。
假設(shè)垂直的柱狀圖:每根柱子有一個寬度,待分析的數(shù)據(jù)落在柱子的寬度區(qū)間內(nèi),則進(jìn)行相應(yīng)的計數(shù)。y是數(shù)據(jù)落在每個寬度區(qū)間內(nèi)的元素個數(shù),決定了柱子的高度。y值可以是絕對的count,也可以是相對的百分比 binCount/N。binCount是每個柱子絕對的count,N是總的樣本數(shù)量。
實驗數(shù)據(jù):serverdata.txt
決定柱狀圖形狀有兩個參數(shù):
1. 每根柱子的寬度 bin width (分箱寬度)
bin width太寬,會丟失很多細(xì)節(jié)信息。太窄,會導(dǎo)致很多箱子都沒有數(shù)據(jù),從而數(shù)據(jù)分布的形狀不夠顯而易見。
選擇好的bin width很重要。對于正態(tài)分布,可以嘗試使用Scott rule: 
[java] view plain copy
 print?在CODE上查看代碼片派生到我的代碼片
serverdata <- read.table("serverdata.txt", col.names="CPU")  
with(  
  data=serverdata,  
  
  {  
    w=trunc((3.5*sd(CPU)) / (length(CPU)^(1/3)))  
    par(mfrow=c(2,1))  
    hist(CPU,breaks=w,freq=T, main = "frequency histogram")  
    hist(CPU,breaks=w,freq=F, main = "Non frequency histogram")  
  }  
)  

bin witdth可以不一樣寬:

注意 breaks是一個遞增向量,箱寬由當(dāng)前減去前一個所得。


2. 第一個箱子開始的值(即第一個柱子左邊線在x軸上開始的位置)bin alignment
核密度估計 Kernal Density Estimate(KDE)

數(shù)據(jù)分析咨詢請掃描二維碼

若不方便掃碼,搜微信號:CDAshujufenxi

數(shù)據(jù)分析師資訊
更多

OK
客服在線
立即咨詢
客服在線
立即咨詢
') } function initGt() { var handler = function (captchaObj) { captchaObj.appendTo('#captcha'); captchaObj.onReady(function () { $("#wait").hide(); }).onSuccess(function(){ $('.getcheckcode').removeClass('dis'); $('.getcheckcode').trigger('click'); }); window.captchaObj = captchaObj; }; $('#captcha').show(); $.ajax({ url: "/login/gtstart?t=" + (new Date()).getTime(), // 加隨機數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調(diào)用 initGeetest 進(jìn)行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調(diào),回調(diào)的第一個參數(shù)驗證碼對象,之后可以使用它調(diào)用相應(yīng)的接口 initGeetest({ // 以下 4 個配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺檢測極驗服務(wù)器是否宕機 new_captcha: data.new_captcha, // 用于宕機時表示是新驗證碼的宕機 product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計時完成 $(".getcheckcode").removeClass('dis').html("重新獲取"); }else{ $(".getcheckcode").addClass('dis').html("重新獲取("+_wait+"s)"); _wait--; setTimeout(function () { codeCutdown(); },1000); } } function inputValidate(ele,telInput) { var oInput = ele; var inputVal = oInput.val(); var oType = ele.attr('data-type'); var oEtag = $('#etag').val(); var oErr = oInput.closest('.form_box').next('.err_txt'); var empTxt = '請輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請輸入正確的'+oInput.attr('placeholder')+'!'; var pattern; if(inputVal==""){ if(!telInput){ errFun(oErr,empTxt); } return false; }else { switch (oType){ case 'login_mobile': pattern = /^1[3456789]\d{9}$/; if(inputVal.length==11) { $.ajax({ url: '/login/checkmobile', type: "post", dataType: "json", data: { mobile: inputVal, etag: oEtag, page_ur: window.location.href, page_referer: document.referrer }, success: function (data) { } }); } break; case 'login_yzm': pattern = /^\d{6}$/; break; } if(oType=='login_mobile'){ } if(!!validateFun(pattern,inputVal)){ errFun(oErr,'') if(telInput){ $('.getcheckcode').removeClass('dis'); } }else { if(!telInput) { errFun(oErr, errTxt); }else { $('.getcheckcode').addClass('dis'); } return false; } } return true; } function errFun(obj,msg) { obj.html(msg); if(msg==''){ $('.login_submit').removeClass('dis'); }else { $('.login_submit').addClass('dis'); } } function validateFun(pat,val) { return pat.test(val); }