cost 112 ms
R 中計算 XIRR 時 uniroot 出錯

[英]Error in uniroot while calculating XIRR in R

賞金將在 6 天后到期。 此問題的答案有資格獲得+50聲望賞金。 ottodidakt想提請更多人關注這個問題。 可重現的例子: Excel XIRR 返回 0.125,這似乎是正確的。 uniroot文檔說“必須指定間隔或下限和上限”,我不確定 tvm::xirr 是否這樣做。 我猜它確實 ...

2023-01-05 20:37:48   2   102    r / xirr / uniroot  
使用 uniroot 更新函數中的值

[英]Update value in function using uniroot

我想根據 R 中 uniroot 的結果更新函數中的特定值。 例如,如果我試圖求解 x,其中 s=60000 和 t=19.95,我有: (sx-0.05*(0.04*x + 1810.726 - mu(40,t)*(sx)))=59789 對於下一次迭代,我想更新 s 的值,使 s=59789,以 ...

2022-12-22 10:27:05   2   44    r / uniroot  
如何為 nls 模型預測給定 y 的 x?

[英]how to predict x given y for nls model?

我正在使用 R 中的 nls SSlogis 函數來制作一個模型來表示植物的吸水率,其中 y = 吸水率(g / m^2),x = 水中的分鍾數。 對於給定的 y 值(在本例中為最大吸水率),我想使用每個模型(我有幾個物種,每個物種都有一個單獨的模型)求解 x(我們達到峰值吸收的那一刻)。 我試過 ...

2022-12-15 11:39:51   1   37    r / nls / uniroot  
為什么我不能將 uniroot 與 plot 一起使用?

[英]Why can't I use uniroot with plot?

我正在研究使用uniroot function 來近似方程的根的代碼。 我正在嘗試 plot function 的行為通過uniroot作為自由變量的值更改: f_est 的f_est按預期工作。 但是,當通過plot function 時,uniroot 似乎會中斷: function 的設 ...

Uniroot解兩個方程

[英]Uniroot solution two equatations

幾天后我發布了類似的問題,但現在我有更復雜的問題。 我有這個數據集 價格由以下等式定義(product[["length"]] * old_const * 2) + setup_price其中old_const = 0.0158和setup_price = 20.8 現在我想更改常量setup_pr ...

當根 function 有多個 arguments 時,為什么 uniroot.all 拋出未使用的變量錯誤?

[英]Why is uniroot.all throwing unused variable error when root function has multiple arguments?

千載難逢的時候,我需要使用來自rootSolve uniroot.all來找到具有多個 arguments 的 function 的根。每次我這樣做都會遇到一堆障礙,我最終解決了,但是下次我會忘記我是如何解決它們的。 所以,這次我在這里記錄障礙,希望下次我可以只看這里,看看如何快速解決它們。 這是 ...

2022-05-08 15:36:20   1   50    r / uniroot  
如何避免停止循環的 uniroot 錯誤?

[英]How can I avoid uniroot error that stops the loop?

我在循環中運行uniroot function,但遇到錯誤並且代碼停止。 代碼如下; 運行上面的代碼,遇到以下錯誤: 代碼在j=1處停止,並且沒有 go 到j=2 & 3 。 因此, dat$f顯示 我的目標是當uniroot在給定的j中遇到錯誤時,將NA放入dat$f[j]中,然后繼續循 ...

R function "uniroot": 搞錯了

[英]R function "uniroot": get some mistake

FX <- function(x)(3/4)*(1-x^2) M <- 5000 X2 <- rep(NA,M) for (i in 1:M) { U2 <- runif(1) fct <- function(x)FX(x)-U2 X2[i] &lt ...

R:求解變量(使用 uniroot 函數)

[英]R: Solving for a variable (using the uniroot function)

我對 R 比較陌生,確實可能需要社區的幫助來解決以下問題。 我正在嘗試求解以下方程中的變量 r: (EPS2 + r*DPS1-EPS1)/r^2)-PRC 。 這是我解決問題的(失敗)嘗試(使用 uniroot 函數): 然后我收到以下錯誤: f(lower, ...) 中的錯誤:未使用的 ...

模擬中的 Uniroot

[英]Uniroot in simulations

我試圖找到生成 function 的累積和為 0(或最接近 0 的值)的值。 我有一個簡單的計算:x - y(1-z) 其中 z 是關鍵變量。 問題是 x 和 y 是模擬的,因此它們不會保持不變。 這是可重現的示例: 我知道,由於 function 的值 x 和 y 不斷變化,uniroot 將找 ...

2021-02-19 22:51:52   1   43    r / uniroot  
逐行求解X

[英]Solve for X row by row

我將從我已經做過的開始。 我正在尋找一種通過更改每行的b和s參數來求解方程f的方法, Q和n是常數。 我知道 apply() 適用於此類問題,但這似乎對我不起作用。 我想找到的變量沒有給出唯一的解決方案。 使用這些參數,假設b = 0.5和s = 0.01使用 uniroot() 我得到以下信息。 ...

源代碼中的 uniroot() 函數在修改后不起作用; 無法弄清楚錯誤

[英]uniroot() function in source code does not work with modification; Could not figure out the error

我試圖找出 R 中兩條曲線交點的坐標。輸入數據是兩條曲線中經驗點的坐標。 我的解決方案是使用函數curve_intersect() 。 我需要為 2000 次重復(即 2000 對曲線)執行此操作。 所以我把數據放在兩個列表中。 每個列表包含 1000 個數據框,每個數據框中的一條曲線的 x 和 y ...

用 r 求解兩邊有變量的方程

[英]solving equations with variables on both sides with r

0.5Q+30 = −0.2Q+100 0.5q+0.2q=100-30 70=0.7q q=70/0.7 q=100 0.5*100+30 =80 是否有一個包可以解決兩邊都有變量的方程? ...

2020-09-08 22:34:38   1   67    r / uniroot  

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM