two-sample Kolmogorov-Smirnov test p-value in R confusion

I’m confused about the appropriate interpretation of p-values returned by the two-sample Kolmogorov-Smirnov test (ks.test) in R.

In slide 23 of this presentation about non-parametric two-sample tests, the author states that when analyzing the ks.test results:

ks.test(male, female)
Two-sample Kolmogorov-Smirnov test
data: male and female 
D = 0.8333, p-value = 0.02597

the p-value

needs to be multiplied by 2 for a 2-tail test. Thus, P = 0.05194

Is that true?

If we used the original p = 0.02597, we would reject the hypothesis that the distributions similar, because p < 0.05, correct? Whereas if we multiply it by 2, the p would suggest that there is no difference between distributions, since p > 0.05?

What am I missing?

All topic

How to display the value of select option as response using Node.js

I am new to Node.js and Express

I am trying to fetch the selected option from the select list of an HTML page and display as a response using node.js

HTML

Index.JS

var express = require('express')
var bodyParser = require("body-parser");
var app = express()

app.use(express.static('public'))

app.use(bodyParser.urlencoded({ extended: false }));

app.post('/survey', function (req, res) {
    let month = req.body.monthofbirth;
});

app.listen(3000, function () {
    console.log('Example app listening on port 3000!')
})

When I try to print the response using the code res.write(${month}); It displays the value of the option like 1, 2, 3 etc but I have to display the text like January, February etc.

please help me out with this 🙁

All topic

pandas – combine multiple columns values based on value of other column

I really hope I can make sense here. I have a dataframe like such:

A     |    B
-------------

123   | some texty text
123   | more texty text
123   | and the last bit of texty text
456   | oh wow this has some texty text too
456   | but not as much

Now, what I am trying to do is find a way where I can combine all the corresponding text for each A value into one row only. So it would look like this:

A     |    B
-------------

123   | some texty text more texty text and the last bit of texty text
456   | oh wow this has some texty text too but not as much

using for loops on pandas df hasn’t been yielding proper results. And other approaches I have tried end up putting all the text for the entire dataframe into a new column. Or, I get stuck in an infinite loop.

Still new to pandas and haven’t come across a conundrum such as this one.

Any help is immensely appreciated.

Mark

Any help is immensely appreciated.

All topic

Expected value of number of trials to get k SUCCESSIVE successes

Independent trials, each of which is a success with probability p, are performed until there are k consecutive successes. What is the mean of the number of the necessary trials?

Let $N_k$ be the number of trials needed to get k successive successes.

While I am convinced that to answer this problem we should start by
doing $$M_k = E[N_k]= E[E[N_k|N_{k-1}]]$$
like explained in another post on StackExchange(See Expectation by conditioning)
I don’t understand how to complete the solution.
The suggested solution is $$begin{align} M_k &= E[N_k] (line1 ) \&= E[E[N_k|N_{k-1}]] (Line 2)
\&=E[p(N_{k-1}+1)+q[N_{k-1}+1+E[N_k]]] (line3)
\ &=E[N_{k-1}+1+qE[N_k]] (Line 4 )
\ &=E[N_{k-1}]+1+qE[N_k] (Line 5 )
\&= M_{k-1}+1+qM_{k} (Line 6 )
\&=frac{1}{p}+frac{M_{k-1}}{p} (Line 7 ), M_0=0 end{align}$$

What I don’t understand is $(line3)$ especially $ q* [N_{k-1}+1+E[N_k]]$

Please someone could provide me an explanation ?

Thank you

All topic

What is the value of of the expression below

If $f(0) =0$ and $f”(x)$ exists then what is the value of $$f'(x)-frac{f(x)}{x}$$

I tried Tailor and Lagrange theorems but to no avail.

clearly $f”(c)=2frac{f(x)-xf'(0
)}{x^2}$ where $0

All topic

What is the Experimental value for freezing point of water, in degrees farenheight. Unit conversion from degrees Celsius to degrees farenheight [on hold]

Wondering how to solve this. What is the experimental value for freezing point of water? Do I take this value and turn it into farenheight??

All topic

Check if its value equal to other ones value

Here is listing.

hello (value1 is red – value2 is apple)
world (value1 is yellow – value2 is car)
welcome (value1 is apple – value2 is bus)

welcome value1 and hello value2 is equal. Both are apple.

if ( value1 === $value2 ) 

This cant help because comparing value1 and value2 not between listing. It is just checking is apple equal to bus (for welcome.) But need to check if welcome’s value1 equal to hello’s value2.

Sorry for this terrible explanation but I am new to coding.

All topic

What is a Limit or Limiting-value?

As far as I understand, the following is my personal definition for limits/limiting-values:

If the value of a function cannot be determined for any value of the independent variable, then, the value the function seems to be approaching would be its limiting value for that particular value of the independent variable.

For instance, $f(x)=frac{2x}{x+1}$’s limiting value is $2$ at $infty$ as we can’t determine the value of $f(x)$ at $x=infty$. But, it seems that $f(x)$ is approaching $2$ when $x$ approaches $infty$.
enter image description here

Am I correct?

All topic

probability distribution of the maximum value out of v normally distributed values

I specialize in computer science so statistics isn’t my forte but I need some statistics knowledge for my current project.

I have a list of variables whose values have a roughly standard normal probability distribution. The variables are compared and the maximum value is saved for later use. I want to know what the probability distribution of the max value is.

Rationally it should be something like P = N x (∫N)^(v-1) where N is a standard normal distribution ∫N is the integral of a standard normal distribution and v is the number of variables being compared. This theory is however a little hard to test as, if I understand correctly, the integral of a standard normal distribution cannot be calculated in Cartesian space.

Is there more known about this problem? Is the resultant distribution a normal distribution? if not can it be expressed as a Cartesian function? if not can the Mean be calculated easily? Any information that would narrow down the behavior of the max value would be helpful.

The number of variables being compared can be any value, but the most common, most important case is v=4 if that helps.

All topic

Which style is better: Return a DWORD value from function or pass a pointer to DWORD in C++?

I’m designing and implementing a DLL and there is a function I need to get the length of a string that I can do in two ways:

DWORD GetSecondNameLength()

or
HRESULT GetSecondNameLength(DWORD *length)

Can anyone suggest which style is better? This is not a COM DLL so return type doesn’t have to be HRESULT, it could be a BOOL or some error code. I’m just using HRESULT to illustrate here.

All topic