So here is the next version.
Why does the intercept needs lower.tail=TRUE to give the same result as
summary() for value=0?
# See Verzani, simpleR (pdf), p. 80
coeff.test - function(lm.result, idx, value) {
# idx = 1 is the intercept, idx1 the other coefficients
# null hypothesis: coeff =
Hello,
from Verzani, simpleR (pdf), p. 80, I created the following function to
test the coefficient of lm() against an arbitrary value.
coeff.test - function(lm.result, var, coeffname, value) {
# null hypothesis: coeff = value
# alternative hypothesis: coeff != value
es - resid(lm.result)
coeffname - deparse(substitute(var))
Is that what you wanted?
Yes! That gets rid of the extra parameter.
Thanks
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Hello Petr,
thank you for your ideas. The split() looks most realistic.
What about this idea:
1. Define three functions Refun1, Refun2, Refun3 for the three different
sections of the calculations (same as you suggested)
2. lambda = (Re = 2320) * Refun1(Re) + ((Re 2320) (Re 65 * dk))
*
Hello Petr,
but I think this is how your code really works. Did you try it?
it does, but the R documentation says somewhere:
Warning: for() loops are used in R code much less often than in
compiled languages. Code that takes a `whole object' view is likely to
be both clearer and faster in R.
Hello Petr,
If you want to get results of your function for a vector of reynolds and
dk you can use function outer and probably get rid of for cycle in the
function.
outer(c(100, 530,2410), c(10, 150,200),lambda_wall)
[,1] [,2] [,3]
[1,] 0.640 0.6400
Dear all,
I am new to R and to it's programming philosophy. The following function
is supposed to work on a vector, but I can't figure out how to do that
without looping through every element of it. Is there a more elegant
way?
Note: I have shortened it, so it is NOT correct from the pipe
Hello Bernardo,
-
If I understood your problem this script solve your problem:
q-0.15 + c(-.1,0,.1)
h-10 + c(-.1,0,.1)
5*q*h
[1] 2.475 7.500 12.625
-
OK, this solves the simple example.
But what if the example is not that simple. E.g.
P = 5 * q/h
Here, to get the maximum
Dear list,
I am from an engineering background, accustomed to work with tolerances.
For example, I have measured
Q = 0.15 +- 0.01 m^3/s
H = 10 +- 0.1 m
and now I want to calculate
P = 5 * Q * H
and get a value with a tolerance +-
What is the elegant way of doing this in R?
Thank you,
9 matches
Mail list logo