Displaying 3 results from an estimated 3 matches for "yfun".
Did you mean:
fun
2020 Oct 06
4
Solving a simple linear equation using uniroot give error object 'x' not found
.... When I try to use uniroot to solve the equation I get an error message,
Error in yfu n(x,10,20) : object 'x' not found.
I hope someone can tell we how I can fix the problem
if(!require(rootSolve)){install.packages("rootSolve")}
library(rootSolve)
# Define the function
yfun <- function(x,diffMean,diffSE) ((abs(diffMean)-x)/diffSE)
# Prove the function and a call to the function work
yfun(10,100,10)
# use uniroot to find a solution to the
# function in the range -100 to 100
uniroot(yfun(x,10,20),c(-100,100))
My output:
> # Define the function
>...
2020 Oct 06
0
Solving a simple linear equation using uniroot give error object 'x' not found
...I get an error message,
> Error in yfu n(x,10,20) : object 'x' not found.
>
> I hope someone can tell we how I can fix the problem
>
> if(!require(rootSolve)){install.packages("rootSolve")}
> library(rootSolve)
>
> # Define the function
> yfun <- function(x,diffMean,diffSE) ((abs(diffMean)-x)/diffSE)
> # Prove the function and a call to the function work
> yfun(10,100,10)
> # use uniroot to find a solution to the
> # function in the range -100 to 100
> uniroot(yfun(x,10,20),c(-100,100))
>
>
> M...
2012 Dec 22
1
creating a function
Dear R users,
I’d like to create a function as:
Y.t+1 = Y.t + (1\p)*summation(x(Y.t,Y.t-1,...)) + epsilon.t
where x is a function of Y.t, Y.t-1 and so on, epsilon is a random error and p is a parameter.
Do you think something of the following form might be appropriate?
Y<-function(Y,p,x,epsilon){
for (i in 2:length(Y)) {