본문 바로가기
반응형

R71

(R)How to add several line graphs to a graph / rearrange the order of colour label/ How to add colours to each graph > x df_1 df_5 df_20 T ggplot(data=T,aes(x))+geom_line(aes(y=df_1))+geom_line(aes(y=df_5))+geom_line(aes(y=df_20))+geom_line(aes(y=dnorm(x,0,1))) > ggplot(data=T,aes(x))+geom_line(aes(y=df_1),col="red")+geom_line(aes(y=df_5),col="blue")+geom_line(aes(y=df_20),col="yellow")+geom_line(aes(y=dnorm(x,0,1))) > ggplot(data=T,aes(x))+geom_line(aes(y=df_1,col="df_1"))+geom_line(aes(y=df_5,col="df_5"))+ge.. 2020. 10. 9.
(R) Central limit theorem I will use a Poisson distribution as the 'any distribution' to show what central limit theorem means using R. Where n is the number of random values to return and lambda is the unique parameter of the Poisson distribution which is the mean and variance of the distribution. #making 1 random sample from Poisson distribution with lambda 1. > rpois(1,1) [1] 0> rpois(1,1)[1] 3> rpois(1,1)[1] 1> rpois.. 2020. 9. 27.
(R) Normal approximation to Binomial There is an important property of binomial distribution which is the sum of n independent and identically distributed Bernoulli distribution. The property is called 'Normal approximation to Binomial.' When X~bin(n,p) we can approximate the binomial distribution with Normal distribution which has the mean np and the variance np(1-p) If n is large enough and p is close to 1/2. That is the conditio.. 2020. 9. 27.
(R) geom_violin() - a density graph geom_violin is an efficient density graph. The violin graph is created by mirroring the kernel density curve symmetrically. It is usefully used for comparing several density graphs without overlapping. geom_violin() geom_density() > ggplot(data=birthwt,aes(x=smoke,y=bwt))+geom_violin() > ggplot(data=birthwt,aes(x=bwt))+geom_density()+facet_grid(vars(smoke))>ggplot(data=birthwt,aes(x=bwt,colour=s.. 2020. 9. 9.
반응형