# نصب بستههای مورد نیاز install.packages("ggplot2") install.packages("fitdistrplus") # بارگذاری بستهها library(ggplot2) library(fitdistrplus) # دادهها data <- c(10.01, 3.76, 9.91, 7.40, 6.09, 6.60, 2.65, 2.52, 7.93, 4.97, 5.70, 1.08, 4.43, 2.90, 3.97, 4.64, 4.99, 5.49, 4.03, 6.11, 5.37, 3.54, 2.37, 3.19, 4.09, 4.48, 6.85, 7.09, 7.16, 4.67, 5.15) # برازش توزیع Power Lomax fit_pl <- fitdist(data, "lnorm") # فرض میکنیم دادهها با توزیع لوگ-نرمال برازش داده شدهاند # نمودار تابع چگالی احتمال (PDF) pdf_plot <- ggplot(data.frame(x = data), aes(x = x)) + geom_histogram(aes(y = ..density..), bins = 10, fill = "lightblue", color = "black", alpha = 0.6) + stat_function(fun = dlnorm, args = list(meanlog = fit_pl$estimate["meanlog"], sdlog = fit_pl$estimate["sdlog"]), color = "blue", size = 1) + labs(title = "Fitted PDF of the PL Distribution", x = "GDP Growth", y = "Density") + theme_minimal() # نمودار تابع توزیع تجمعی (CDF) cdf_plot <- ggplot(data.frame(x = data), aes(x = x)) + stat_ecdf(geom = "step", color = "darkgreen", size = 1) + stat_function(fun = plnorm, args = list(meanlog = fit_pl$estimate["meanlog"], sdlog = fit_pl$estimate["sdlog"]), color = "blue", size = 1) + labs(title = "Fitted CDF of the PL Distribution", x = "GDP Growth", y = "P(X <= x)") + theme_minimal() # نمایش نمودارها pdf_plot cdf_plot
An Error occurred while handling another error: yii\web\HeadersAlreadySentException: Headers already sent in on line 0. in /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php:366 Stack trace: #0 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders() #1 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response->send() #2 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/ErrorHandler.php(135): yii\web\ErrorHandler->renderException() #3 [internal function]: yii\base\ErrorHandler->handleException() #4 {main} Previous exception: yii\web\HeadersAlreadySentException: Headers already sent in on line 0. in /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php:366 Stack trace: #0 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders() #1 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Application.php(656): yii\web\Response->send() #2 /var/www/html/prof-homepages/vendor/faravaghi/yii2-filemanager/models/Files.php(696): yii\base\Application->end() #3 /var/www/html/prof-homepages/vendor/faravaghi/yii2-filemanager/controllers/FilesController.php(484): faravaghi\filemanager\models\Files->getFile() #4 [internal function]: faravaghi\filemanager\controllers\FilesController->actionGetFile() #5 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #6 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams() #7 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction() #8 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction() #9 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest() #10 /var/www/html/prof-homepages/frontend/web/index.php(18): yii\base\Application->run() #11 {main}