Jump to content

Install PHP package


Go to solution Solved by Jacques1,

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536740
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536782
Share on other sites

@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.

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536784
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536814
Share on other sites

$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.

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536815
Share on other sites

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";
Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536819
Share on other sites

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
)
 

 

 

Link to comment
https://forums.phpfreaks.com/topic/302022-install-php-package/#findComment-1536821
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.