
[英]In R how to run Correlation or simple linear Regression between two variables of unequal lengths from different data frames
[英]How do I compute the covariance (and by extension correlation) of two simulated Brownian Motions with different lengths of time, t? (coding on R)
目前正在赶任务,我被困在某个部分。 对于 t = 2,我模拟了 1000 条不同的布朗运动路径,每个单位时间有 500 个时间步长。
n = 500 # number of time points per time unit
T = 2 # number of time units
M = 1000 # number of paths
timePoints = seq(0, T, by = 1 / n) # points during [0,T]
stepsize = 1/n
Brown = matrix(0, nrow = M, ncol = length(timePoints))
for(i in 1:M){
Brown[i,1] = 0
for(j in 2:length(timePoints)){
Brown[i,j] = Brown[i,j-1] + rnorm(1,0,stepsize)
}
}
现在的问题是,我必须使用模拟路径来计算相关性 (W1, W2) 的近似值,其中 Wt 是 t 时间长度的布朗运动。 我知道如何近似时间长度(和时间步长)相似的两个不同随机过程的二次变化,但是如何计算两个不同长度的过程的二次协变?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.