Compute Randomly Drawn Chi Square Density in R Programming – rchisq() Function
Last Updated :
25 Jun, 2020
rchisq()
function in R Language is used to compute random chi square density for a set of values.
Syntax: rchisq(N, df)
Parameters:
N: Sample Size
df: Degree of Freedom
Example 1:
set .seed( 1000 )
N < - 20
y < - rchisq(N, df = 10 )
y
|
Output:
[1] 7.208082 11.236799 3.780669 5.972266 12.174243 14.308333 3.886482
[8] 4.117081 13.015581 3.864009 8.494487 17.713528 2.411329 7.096494
[15] 4.546996 11.542960 9.683502 9.073933 11.120782 9.193626
Example 2:
set .seed( 1000 )
N < - 500
y < - rchisq(N, df = 10 )
plot(y)
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...