Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Draw Normal, Left & Right Skewed Distributions (2 Examples) | ggplot2 Density Plot | tidyr Package

Автор: Statistics Globe

Загружено: 2022-07-03

Просмотров: 693

Описание:

How to plot normal, left, and right skewed densities in the R programming language. More details: https://statisticsglobe.com/draw-norm...
R code of this video:

set.seed(35486) # Create random distributions
data <- data.frame(x1 = rbeta(1000, 10, 2),
x2 = rbeta(1000, 5, 2),
x3 = rnorm(1000),
x4 = rbeta(1000, 2, 5),
x5 = rbeta(1000, 2, 10))

plot(density(data$x1), col = 2, # Overlay all columns as densities
xlim = c(- 3, 3),
ylim = c(0, 5))
lines(density(data$x2), col = 3)
lines(density(data$x3), col = 4)
lines(density(data$x4), col = 5)
lines(density(data$x5), col = 6)
legend("topleft", # Add legend to plot
legend = c("x1 = rbeta(1000, 10, 2)",
"x2 = rbeta(1000, 5, 2)",
"x3 = rnorm(1000)",
"x4 = rbeta(1000, 2, 5)",
"x5 = rbeta(1000, 2, 10)"),
col = 2:6,
lty = 1,
cex = 0.8)

install.packages("tidyr") # Install & load tidyr
library("tidyr")

data_long <- data %>% # Convert wide to long data
pivot_longer(colnames(data)) %>%
as.data.frame()

install.packages("ggplot2") # Install ggplot2 package
library("ggplot2") # Load ggplot2 package

ggplot(data_long, # Draw all densities in ggplot2 plot
aes(value,
fill = name)) +
geom_density(alpha = 0.25)

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com

Draw Normal, Left & Right Skewed Distributions (2 Examples) | ggplot2 Density Plot | tidyr Package

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

array(10) { [0]=> object(stdClass)#5247 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "MVyRXF3j_JE" ["related_video_title"]=> string(104) "Add Standard Error Bars to Barchart (2 Examples) | Draw Barplot in Base R & ggplot2 | stat_summary()" ["posted_time"]=> string(21) "2 года назад" ["channelName"]=> string(16) "Statistics Globe" } [1]=> object(stdClass)#5220 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "OdbuU9iJ_H4" ["related_video_title"]=> string(103) "Insightful Data Visualization Using ggplot2 in R (Ft. @rappa753 ) | Drawing Advanced Plots & Graphs" ["posted_time"]=> string(19) "1 год назад" ["channelName"]=> string(16) "Statistics Globe" } [2]=> object(stdClass)#5245 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "ZA4JkHKZM50" ["related_video_title"]=> string(84) "Почему "вероятность 0" не означает "невозможно"" ["posted_time"]=> string(19) "5 лет назад" ["channelName"]=> string(11) "3Blue1Brown" } [3]=> object(stdClass)#5252 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "FzfE8tfbpvQ" ["related_video_title"]=> string(48) "Density Plot in R with ggplot and geom_density()" ["posted_time"]=> string(21) "4 года назад" ["channelName"]=> string(15) "The Data Digest" } [4]=> object(stdClass)#5231 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "mThiyFYEQhY" ["related_video_title"]=> string(163) "«Будем жить!» | Хитрая передача на Первом канале о вернувшихся с СВО (English subtitles) @Max_Katz" ["posted_time"]=> string(22) "22 часа назад" ["channelName"]=> string(19) "Максим Кац" } [5]=> object(stdClass)#5249 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "8L51FUsjMxA" ["related_video_title"]=> string(115) "Как устроена База Данных? Кластеры, индексы, схемы, ограничения" ["posted_time"]=> string(27) "6 месяцев назад" ["channelName"]=> string(25) "Артём Шумейко" } [6]=> object(stdClass)#5244 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "Rp6Xwy4BfxI" ["related_video_title"]=> string(96) "Learn to plot Data Using R and GGplot2: Import, manipulate , graph and customize the plot, graph" ["posted_time"]=> string(21) "3 года назад" ["channelName"]=> string(15) "Rajendra Choure" } [7]=> object(stdClass)#5254 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "MQ8ibs-JiRo" ["related_video_title"]=> string(102) "Заявление Путина о завершении войны / Последнее условие" ["posted_time"]=> string(23) "6 часов назад" ["channelName"]=> string(10) "NEXTA Live" } [8]=> object(stdClass)#5230 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "p0Ri2tNb-6I" ["related_video_title"]=> string(186) "Человечество навсегда ЗАПЕРТО в Солнечной системе? Астрофизик Борис Штерн раскрыл неприятную правду" ["posted_time"]=> string(24) "16 часов назад" ["channelName"]=> string(23) "Глеб Соломин" } [9]=> object(stdClass)#5248 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "STaUe8fmEIU" ["related_video_title"]=> string(154) "⚡️2 ЧАСА НАЗАД! русским устроили ДРОНОВЫЙ АД, наступление на Сумы остановлено - НАКИ" ["posted_time"]=> string(23) "5 часов назад" ["channelName"]=> string(31) "Телеканал Прямий" } }
Add Standard Error Bars to Barchart (2 Examples) | Draw Barplot in Base R & ggplot2 | stat_summary()

Add Standard Error Bars to Barchart (2 Examples) | Draw Barplot in Base R & ggplot2 | stat_summary()

Insightful Data Visualization Using ggplot2 in R (Ft. @rappa753 ) | Drawing Advanced Plots & Graphs

Insightful Data Visualization Using ggplot2 in R (Ft. @rappa753 ) | Drawing Advanced Plots & Graphs

Почему

Почему "вероятность 0" не означает "невозможно"

Density Plot in R with ggplot and geom_density()

Density Plot in R with ggplot and geom_density()

«Будем жить!» | Хитрая передача на Первом канале о вернувшихся с СВО (English subtitles) @Max_Katz

«Будем жить!» | Хитрая передача на Первом канале о вернувшихся с СВО (English subtitles) @Max_Katz

Как устроена База Данных? Кластеры, индексы, схемы, ограничения

Как устроена База Данных? Кластеры, индексы, схемы, ограничения

Learn to plot Data Using R and GGplot2: Import, manipulate , graph and customize the plot, graph

Learn to plot Data Using R and GGplot2: Import, manipulate , graph and customize the plot, graph

Заявление Путина о завершении войны / Последнее условие

Заявление Путина о завершении войны / Последнее условие

Человечество навсегда ЗАПЕРТО в Солнечной системе? Астрофизик Борис Штерн раскрыл неприятную правду

Человечество навсегда ЗАПЕРТО в Солнечной системе? Астрофизик Борис Штерн раскрыл неприятную правду

⚡️2 ЧАСА НАЗАД! русским устроили ДРОНОВЫЙ АД, наступление на Сумы остановлено - НАКИ

⚡️2 ЧАСА НАЗАД! русским устроили ДРОНОВЫЙ АД, наступление на Сумы остановлено - НАКИ

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]