![](/img/trans.png)
[英]Modifying the decimal mark of stat_poly_eq
我使用ggpmisc包中的stat_poly_eq函數在我的 ggplots 中添加回歸方程。 它工作得很好。 但是,我想將方程式的小數點從句號改為逗號,但我不知道該怎么做。 有什么建議么? ...
[英]Modifying the decimal mark of stat_poly_eq
我使用ggpmisc包中的stat_poly_eq函數在我的 ggplots 中添加回歸方程。 它工作得很好。 但是,我想將方程式的小數點從句號改為逗號,但我不知道該怎么做。 有什么建議么? ...
[英]How to fill the background of a stat_poly_eq equation (ggpmisc) using ggplot2?
有沒有辦法用白色(或任何其他顏色)填充 stat_poly_eq 方程ggpmisc的背景,以便隱藏 panel.grid 的黑線? 下面是我想要的圖表: 感謝幫助 ...
[英]How does lm() work when one axis is logarithmic?
我已經嘗試通過幾種不同的方式將線性方程擬合到具有對數 y 軸的數據。 當我使用 stat_poly_line 和 stat_poly_eq 時,我似乎得到了正確的直線和方程。 (參見 mtcars 示例) 但是當我使用 lm() 來擬合直線時,我得到了不同的斜率和截距。 即使繪圖上繪制的線看起 ...
[英]Is it possible to extract slope and intercept from multiple fitted lines into a tibble?
我正在嘗試比較許多單獨擬合線的斜率和截距,並希望從使用 stat_poly_eq 顯示的方程中提取此信息。 我能夠繪制所有數據和線,但由於在我的實際數據中我有超過 50 個方程,我想要一種簡單的方法來提取每條線的斜率和截距。 下面是使用 mtcars 生成類似圖的代碼。 我想將輸出添加為帶有 c ...
[英]stat_poly_eq() red text for significant p-value in facetwrap
我有一系列回歸包含在 facet_wrap 中,我想知道是否可以在 stat_poly_eq() [ggpmisc] 函數中用紅色文本或“*”表示重要 pval 的文本? 這是我的示例代碼 ...
[英]Remove data to the left and right of local minima
我有很多測量結果,我得到的數據看起來像這樣: 如果我 plot 這個我可以看到有最左邊和最右邊的局部最小值。 我想要做的是修剪那些位於minimum 1左側和minimum 2右側的數據。 這不是非常簡單,因為這兩點之間也可能存在局部最小值,因為真實數據看起來並不理想。 我還需要將此過程應用於許多 ...
[英]Trend line changes depending on axis scale in ggplot2
我正在使用 ggplot2 和 ggmics 來生成趨勢線。 對於g ,label 是y = 6.26 - 0.351x 對於gg ,它是y = 0.782 - 0.0419x 當我使用指數表示法時, eq.label的值會發生變化。 我認為eq.label不應該改變,因為我只是改變軸比例。 你能 ...
[英]Trying to graph different linear regression models with ggplot and equation labels
這是我正在使用的數據集的 dput: 所以在我在 R 中運行線性回歸之前,我會使用這樣的簡單代碼: 這會給我一個帶有這種方程標簽的圖表: 但是,我正在嘗試運行多元線性回歸和分層回歸,但是當我嘗試添加第三個變量時,我不完全確定如何 1) 將第三個變量 (Z) 繪制為回歸圖線和 2) 得到 ...
[英]Can't get R2 values in two decimal using ggplot2 and ggpmisc
很抱歉,在這里尋求幫助時我不知道如何制作可重現的示例。 因此,我提供以下代碼和數據; <350 KB 這里(數據: https://easyupload.io/1r5xuo ),如果你可以看看。 我的問題是:我想要 R2 的兩個十進制值(如附圖所示),即使我使用了 digits=2,我也無法 ...
[英]Color ggscatter by R and P values
我正在繪制一個包裝的 ggscatter,如下圖所示。 我想要的是根據 R 和 P 值進行不同的着色。 比如當P不顯着時,我要plot灰度; 當 P 顯着時,希望 plot 根據 R 值在連續刻度中着色。 問題是我不知道如何獲取這些值以在 ggscatter 中創建 if 語句。 任何人都可以幫助我 ...
[英]Gamma(log) in stat_poly_eq
我在讓 stat_poly_eq 在我的 plot 中打印正確的公式時遇到了一些麻煩。 我當前的 plot 繪制如下。 如您所見,我對 model 我的數據使用了 gamma(log) 分布。 我還在 glm function 中使用了相同的分析,它為我提供了兩個系數,即 glm 的 output ...
[英]How to force trailing zeroes in 'polynom::polynomial' object? (specifically to modify behavior of stat_lm and stat_regline_equation from ggpubr)
我正在嘗試修改stat_regline_equation如何在使用來自 R ggpubr的 ggscatter 制作的ggscatter上顯示回歸線方程。 具體來說,我想顯示一致的系數位數,即使某些舍入系數具有尾隨零,這些零通常被刪除。 這是一個例子: 圖 I 很好,圖 H 刪除了一個尾隨零,圖 ...
[英]Does ggpmisc::stat_poly_eq recompute the trend line math to get the labels?
library(ggplot2) library(dplyr) x <- 1:100 y <- (x + x^2 + x^3) + rnorm(length(x), mean = 0, sd = mean(x^3) / 4) my.data <- data.frame(x = x, ...
[英]How to add number of observations to label of plot (with grouping and faceting) using ggpmisc::stat_poly_eq
x <- 1:100 y <- (x + x^2 + x^3) + rnorm(length(x), mean = 0, sd = mean(x^3) / 4) my.data <- data.frame(x = x, y = y, gr ...
[英]Is there a way to add number of observations to plot label using ggpmisc::stat_poly_eq
x <- 1:100 y <- (x + x^2 + x^3) + rnorm(length(x), mean = 0, sd = mean(x^3) / 4) my.data <- data.frame(x = x, y = y, gr ...
[英]ggpmisc::stat_poly_eq crashes when one group does not have enough data points
library(ggpmisc) data <- mpg table(data$class) data$class[mpg$class=="2seater"] <- c(rep("2seater", 1), rep("compact", 4)) formula <- y ~ x + ...
[英]Displaying regression lines based on P-value
我使用ggpmisc package 在圖中顯示線性回歸模型。 如果 p 值小於 0.2,我只希望在 plot 中顯示回歸線、p 值和 r2 值。 @Ricardo Semião e Castro 幫助我(謝謝)提供了一個很棒的代碼。 但是它有時只起作用。 它是否有效取決於滿足 P <0.2 ...
[英]Adding an offset term to a glm formula in geom_smooth and stat_fit_tidy
我有一個data.frame ,其中三個cluster中每兩個group的計數我正在擬合邏輯回歸(帶有logit link function的binomial glm ),並使用ggplot2的geom_bar和geom_smooth繪制它- 使用ggpmisc的stat_fit_tidy的值。 這 ...
[英]Discrepancy between gggmisc and broom packages in LM estimates
我正在嘗試從許多線性回歸模型中提取斜率值。 我繪制了不同日期的丙酮排放量與水含量的關系。 我有這些圖表和模型 我嘗試使用以下代碼提取斜率值: 還有這段代碼: 然而,這兩個代碼給出的斜率值與我從圖中得到的不同。 關於為什么會這樣的任何想法? 這是數據 我制作的圖表的代碼是: 任何想法為什么我沒有得到相 ...
[英]correct positioning of ggplot insets with ggpmisc in facet
如何在不改變插圖本身的寬度和高度的情況下使用ggpmisc靈活地 position inset ? 對於tibble ,您需要創建一個帶有x的小標題, y表示您想要的 position。 在這里,我希望它們位於左下角,因此指定x = 0.0和y = 0 ( x , y可以是0 - 1從這里的小插圖) ...