lam=3 #a[1] M=5 L=7 t=0.3 r=0.7 #a[3] b=1 #a[2] D1=array(1000) X1=array(1000) D1[1]=rgamma(1,lam^t,b) X1[1]=D1[1] if(X1[1]>M) et1=1 if(X1[1]M) break } et1=length(X1) } et1 round(D1,4) round(X1,4) D2=array(1000) X2=array(1000) D2[1]=rgamma(1,lam^((et1+1-et1*r)*t),b) #D2[1]=rgamma(1,lam^((et1+1-et1*r)*t)-lam^((1-r)*et1*t),b) X2[1]=X1[floor(et1+1-et1*r)]+D2[1] if(X2[1]>M) et2=1 if(X2[1]M) break } et2=length(X2) } et2 round(D2,4) round(X2,4) D3=array(1000) X3=array(1000) floor(et1+et2+1-(et1+et2)*r) D3[1]=rgamma(1,lam^((et1+et2+1-(et1+et2)*r)*t),b) #D3[1]=rgamma(1,lam^((et1+et2+1-(et1+et2)*r)*t)-lam^((1-r)*(et1+et2)*t),b) X3[1]=X1[floor(et1+et2+1-(et1+et2)*r)]+D3[1] if(X3[1]>M) et3=1 if(X3[1]M) break } et3=length(X3) } et3 round(D3,4) round(X3,4) D4=array(1000) X4=array(1000) floor(et1+et2+et3+1-(et1+et2+et3)*r) D4[1]=rgamma(1,lam^((et1+et2+et3+1-(et1+et2+et3)*r)*t),b) #D4[1]=rgamma(1,lam^((et1+et2+et3+1-(et1+et2+et3)*r)*t)-lam^((1-r)*(et1+et2+et3)*t),b) X4[1]=X1[floor(et1+et2+et3+1-(et1+et2+et3)*r)]+D4[1] if(X4[1]>M) et4=1 if(X4[1]M) break } et4=length(X4) } et4 round(D4,4) round(X4,4) L=function(a) -sum(sapply(1:et1,function(j) log(dgamma(D1[j],shape=a[1]^(j*t)-a[1]^((j-1)*t),scale=a[2]))))- sum(sapply(1:et2,function(j) log(dgamma(D2[j],shape=a[1]^((et1+j-(et1+j-1)*a[3])*t)-a[1]^((et1+j-1-(et1+j-2)*a[3])*t),scale=a[2]))))- sum(sapply(1:et3,function(j) log(dgamma(D3[j],shape=a[1]^((et1+et2+j-(et1+et2+j-1)*a[3])*t)-a[1]^((et1+et2+j-1-(et1+et2+j-2)*a[3])*t),scale=a[2]))))- sum(sapply(1:et4,function(j) log(dgamma(D4[j],shape=a[1]^((et1+et2+et3+j-(et1+et2+et3+j-1)*a[3])*t)-a[1]^((et1+et2+et3+j-1-(et1+et2+et3+j-2)*a[3])*t),scale=a[2])))) #L(c(3,1,0.25)) optim(c(3,1,0.1),L)
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/backend/web/index.php(16): yii\base\Application->run()
#11 {main}