![](/img/trans.png)
[英]Getting the y-axis intercept and slope from a linear regression of multiple data and passing the intercept and slope values to a data frame
[英]Need the Slope and Intercept from Linear Regression using Tableau and R
我在Tableau中有一個數據集,我需要使用R中的lm()函數從中獲得線性回歸最佳擬合線的斜率和截距。
回歸是一種基本回歸,只有一個預測變量和一個相關變量。 即使我需要發送整列,我該如何處理需要將聚合值傳遞給lm()函數的事實?
在一個名為“ Predictor”的列和另一個名為“ Dependent”的列中,我基本上需要在Tableau中執行此操作:
fit <- lm(df$Dependent ~ df$Predictor)
return fit
除非我通過Tableau,否則不允許我這樣做
SUM[Dependent] and SUM[Predictor]
但是我不需要匯總它,而是需要它在整個專欄中工作
謝謝
在任何架子(例如明細架子)上添加一個維度,以將數據划分為所需級別。 如果希望將每個單獨的行都包含在模型中,請使用對每個行都有唯一值的維,例如某種行ID。
順便說一句,您知道可以直接在Tableau中執行回歸模型,對嗎? 您不需要僅針對線性模型調用R。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.