當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


R語言 rlogis()用法及代碼示例


rlogis()R語言中的函數用於計算一係列輸入之間的隨機邏輯密度。

用法: rlogis(N)

參數:
N:樣本量

範例1:


# R program to generate 
# random logistic density points
  
# Setting seed for
# random number generation
set.seed(1000)
  
# Set sample size
N <- 20
  
# Calling rlogis() Function
y <- rlogis(N)
y 

輸出:

 [1] -0.71779506  1.14636578 -2.05114837  0.80365206  0.06563317 -2.62196720
 [7]  1.03929969  0.33730220 -1.29048105 -1.06622107 -0.61931410  1.12795649
[13] -0.76720400  1.86443303  1.17562774 -2.54319669 -0.02953117  0.55442681
[19] -2.37810163  0.33889069

範例2:


# R program to generate 
# random logistic density points
  
# Setting seed for
# random number generation
set.seed(1000)
  
# Set sample size
N <- 500
  
# Calling rlogis() Function
y <- rlogis(N)
  
# Plot a graph
plot(y)

輸出:

相關用法


注:本文由純淨天空篩選整理自nidhi_biet大神的英文原創作品 Compute Randomly Drawn Logistic Density in R Programming – rlogis() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。