Displaying 4 results from an estimated 4 matches for "mfactor".
Did you mean:
factor
2017 Nov 02
2
repeat a function
...d is not always the same per row (e.g. if N> jmax, jmax being defined in another function)
I found a workaround. Please see below.
Thereafter I want to optimize this function. Hopefully it works.
Many thanks,
Eric
HWMProb <- function(N) {
ProbUP<- function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 + j * Mfactor(a, dt)) / 2) ######### Probability X going up
ProbMID<- function(a, j, dt) 2 / 3 - (j ^ 2 * Mfactor(a, dt) ^ 2) ######## Probability X going middle
ProbDWN<-function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 - j *...
2017 Nov 03
0
repeat a function
...size of your matrix?
E.g. you use function ProbUP once for row "0" and than for rows different from jmax (if I correctly understand your code). Use of any function depends on two parameters (row and column, let them call u and v)
> ProbUP<- function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 + j * Mfactor(a,
> dt)) / 2) ######### Probability X going up
> ProbMID<- function(a, j, dt) 2 / 3 - (j ^ 2 * Mfactor(a, dt) ^ 2)
> ######## Probability X going middle
> ProbDWN<-function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 - j * Mfactor(a,
>...
2017 Nov 01
3
repeat a function
...pgebe5AL9A_GC8&e=>
jmax<-2
prb <-matrix(0L,nrow=5, ncol=3)
rownames(prb) <- c(seq(-2,2, by = 1))
colnames(prb) <- c(-1,0,1)
a<- 0.1
dt<-1
ExpX <-function(x,a,dt) { ######Defines the Expectation of X on t+1 | t
ExpX <- x*exp(-a*dt)
ExpX
}
Mfactor<-function(a,dt) { #######Factor multiplicative
Mfactor<- exp(-a*dt)-1
Mfactor
}
VarX <-function(sigma,a,dt) { #######Defubes the Variance of X on t+1 | t
VarX <- (sigma^2/(2*a))*(1-exp(-2*a*dt))
VarX
}
DeltaX <-function(sigma...
2017 Nov 02
0
repeat a function
...0L,nrow=5, ncol=3)
> rownames(prb) <- c(seq(-2,2, by = 1))
> colnames(prb) <- c(-1,0,1)
> a<- 0.1
> dt<-1
>
> ExpX <-function(x,a,dt) { ######Defines the Expectation of X
> on t+1 | t
> ExpX <- x*exp(-a*dt)
> ExpX
> }
> Mfactor<-function(a,dt) { #######Factor multiplicative
> Mfactor<- exp(-a*dt)-1
> Mfactor
> }
> VarX <-function(sigma,a,dt) { #######Defubes the Variance of X
> on t+1 | t
> VarX <- (sigma^2/(2*a))*(1-exp(-2*a*dt))
>...