Format numerical value as positive real number

Hi guys!

Which function is used to format a numerical value as a positive real number?


There is the format() function that returns a formatted character version of a number.
What do you need to accomplish?

I want to accomplish an OLR regression with Y <- funding amount.
Funding amount is currently formatted as.numeric. But I receive a negative estimate for the b0 of the regression, which should not be the case:

Estimate Std. Error. t value Pr(>|t|)
(Intercept) -2.065402 1.472629. -1.403 0.16154

So, I want to format Y to be a positive real number. Hope this would improve the outcome of my regression.

The formatting of the numbers is not the problem here. Number formatting is only relevant for the display of results, not for the calculation.

I will first note that the negative value of your intercept is -2.07 and has a standard error of 1.47, giving a p value of 0.16. That means that the intercept is not convincingly different from zero (unless you have set a very, very weak threshold on p for rejecting the null hypothesis). A common expression of that would be that the intercept's difference from zero is not statistically significant but that use of significant leads to a lot of misunderstanding. If you have a strong reason to believe that the intercept cannot be negative, these results are consistent with that.

Your desire to force Y to be positive real numbers does not seem helpful. You can check that they are positive or non-negative with

all(Y > 0)
all(Y >= 0)

Having positive Y values in no way guarantees that the intercept will be positive. If that does not make sense to you, I can explain it further.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.