vivis933 Posted August 27, 2016 Share Posted August 27, 2016 Hi i need THIS package to install on windows using composer but im new here can some one help me. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/ Share on other sites More sharing options...
Jacques1 Posted August 27, 2016 Share Posted August 27, 2016 So what's your question? Note that the library hasn't been released yet (and probably never will), so all you can get with composer is the latest stage of development: composer require kachkaev/php-r dev-master The library also isn't compatible with PHP 7, so if you plan to do an update in the near future, that's a problem. I'd look for an alternative. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536740 Share on other sites More sharing options...
requinix Posted August 27, 2016 Share Posted August 27, 2016 That code is basically just a fancy wrapper around proc_open. If all you need to do is simply run code/a file then it's, like, 15 lines of PHP to do so... Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536764 Share on other sites More sharing options...
Jacques1 Posted August 27, 2016 Share Posted August 27, 2016 There's an R TCP/IP server and an actively maintained client for PHP which takes care of the low-level stuff (parsing etc.). Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536767 Share on other sites More sharing options...
vivis933 Posted August 28, 2016 Author Share Posted August 28, 2016 Thank you for the reply , I need the to integrate the r code in php to make possession distribution for some data in database(mysql) sow i was searching for it and im not satisfied with the results , when i tried to install this library i got to much errors . If some one have a suggestion how to make a possession distribution in php with or without an external library please help me. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536782 Share on other sites More sharing options...
Solution Jacques1 Posted August 28, 2016 Solution Share Posted August 28, 2016 We've proposed three different solutions. So what exactly is wrong with those? And as a fourth option, PHP has a statistics extension with a function for calculating the Poisson distribution. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536783 Share on other sites More sharing options...
vivis933 Posted August 28, 2016 Author Share Posted August 28, 2016 @jacques1 thank you i was using excel for the possession distribution and the formula is this POISSON.DIST(x,mean,cumulative) X Required. The number of events. Mean Required. The expected numeric value. Cumulative Required. A logical value that determines the form of the probability distribution returned. If cumulative is TRUE, POISSON.DIST returns the cumulative Poisson probability that the number of random events occurring will be between zero and x inclusive; if FALSE, it returns the Poisson probability mass function that the number of events occurring will be exactly x. Sow in the example you prepossessed can you tell me which values present the x, mean and cumulative. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536784 Share on other sites More sharing options...
Jacques1 Posted August 28, 2016 Share Posted August 28, 2016 It's Poisson distribution, not “possession distribution”. Sow in the example you prepossessed can you tell me which values present the x, mean and cumulative. The source code. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536785 Share on other sites More sharing options...
vivis933 Posted August 29, 2016 Author Share Posted August 29, 2016 for($x= 0 ; $x<= 10 ; $x++) { $e = (poisson($x+1,2.5) * poisson(0,3.5))*100; echo $e . "\n"; } I make this code from the poisson distribution and ercho return this 0.61968804416659 0.77461005520824 0.6455083793402 0.40344273708762 0.20172136854381 0.084050570226588 0.03001806079521 0.0093806439985032 0.0026057344440287 0.00065143361100716 0.00014805309341072 How i can get the sum of all those numbers? I tryed to make the variable to array and to use sum_array bur it doesent give the correct resul for($x= 0 ; $x<= 10 ; $x++) { $e = array((poisson($x+1,2.5) * poisson(0,3.5))*100); } echo array_sum($e) . "\n"; echo return 0.00014805309341072 Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536814 Share on other sites More sharing options...
requinix Posted August 29, 2016 Share Posted August 29, 2016 $e = array((poisson($x+1,2.5) * poisson(0,3.5))*100);That puts one value into an array and assigns it to $e. Over and over and over again. What it does not do is append the value into the array that is already in $e. While you could fix the code to append to arrays properly, don't. Wouldn't it be much simpler to just sum the values as you go? Set $e to 0 before the loop, then inside the loop add each value to it. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536815 Share on other sites More sharing options...
vivis933 Posted August 29, 2016 Author Share Posted August 29, 2016 Thank you i fixed it $e = array(); for($x= 0 ; $x<= 10 ; $x++) { array_push($e, (poisson($x+1,2.5) * poisson(0,3.5))*100); } echo array_sum($e) . "\n"; Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536817 Share on other sites More sharing options...
vivis933 Posted August 29, 2016 Author Share Posted August 29, 2016 It is possible in the second variable the loop for x to go til 9 not 10 starting from 0 not -1 $e = array(); for($x= 0 ; $x<= 10 ; $x++) { array_push($e, (poisson($x,2.5) * poisson(0,3.5))*100, (poisson($x,2.5) * poisson(1,3.5))*100)///<--second variable ); } echo array_sum($e) . "\n"; i add $x-1 $e = array(); for($x= 0 ; $x<= 10 ; $x++) { array_push($e, (poisson($x,2.5) * poisson(0,3.5))*100, (poisson($x-1,2.5) * poisson(1,3.5))*100)///<--second variable ); } echo array_sum($e) . "\n"; Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536819 Share on other sites More sharing options...
vivis933 Posted August 29, 2016 Author Share Posted August 29, 2016 I tryed with this but i get 8 values insteed 7 <?php $e = array(); for($x= 0 , $x1= 0; $x<= 3 || $x1<= 2; $x++ , $x1++ ) { array_push($e, (poisson($x,2.5) * poisson(0,3.5))*100, (poisson($x1,2.5) * poisson(1,3.5))*100///<--second variable ); } //echo array_sum($e) . "\n"; print_r($e) . "\n"; ?> Array ( [0] => 0.24787521766664 [1] => 0.86756326183323 [2] => 0.61968804416659 [3] => 2.1689081545831 [4] => 0.77461005520824 [5] => 2.7111351932288 [6] => 0.6455083793402 [7] => 2.2592793276907 ) Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536821 Share on other sites More sharing options...
ginerjm Posted August 29, 2016 Share Posted August 29, 2016 Per the manual, this operates as written. Check it out. Quote Link to comment https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.