From e4ae09237108414dc6e4dbd42f3da5ecb8ed54b5 Mon Sep 17 00:00:00 2001 From: cool camel Date: Mon, 4 May 2026 16:07:01 +0200 Subject: [PATCH] baboj --- projekt.rmd | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/projekt.rmd b/projekt.rmd index d6ad06b..8cf3858 100644 --- a/projekt.rmd +++ b/projekt.rmd @@ -213,4 +213,41 @@ model_apartments <- lm(log_price_m2_n ~ centreDistance + summary(model_apartments) par(mfrow = c(2,2)) plot(model_apartments) +``` + +#porównanie dystrybuanty empirycznej z teoretyczną +```{r dyst empi vs dyst teor} +install.packages("ggplot2") +library(ggplot2) +x<-log(rent$price_m2) +z <- seq(min(x), max(x), length.out = 20000) +dystrybuanta_empiryczna<-ecdf(x) +dystrybuanta_teoretyczna<-pnorm(z, mean=mean(x), sd=sd(x)) +ggplot() + + # Dystrybuanta empiryczna + geom_step( + aes(x = z, y = dystrybuanta_empiryczna(z), color = "Empiryczna"), + linewidth = 1, + linetype = "solid" + ) + + # Dystrybuanta teoretyczna + geom_line( + aes(x = z, y = dystrybuanta_teoretyczna, color = "Teoretyczna"), + linewidth = 1, + linetype = "dashed" + ) + + # Dodanie legendy i dostosowanie kolorów + scale_color_manual( + values = c("Empiryczna" = "blue", "Teoretyczna" = "red"), + labels = c("Empiryczna", "Teoretyczna") + ) + + # Etykiety i tytuł + labs( + title = "Porównanie dystrybuanty empirycznej i teoretycznej", + x = "Wartość", + y = "Prawdopodobieństwo skumulowane", + color = "Typ dystrybuanty" # Tytuł legendy + ) + + theme_minimal() + + theme(plot.title = element_text(hjust = 0.5)) ``` \ No newline at end of file