我想對包mixfit函式輸出圖的 x 軸設定限制。mixR此輸出屬于 類mixfitEM。
可重現的示例:首先我模擬了對數法線的混合。
rm(list=ls())
library(mixR)
library("tidyverse")
set.seed(07062022)
N <- 1000
lbda=.5
mu1=1
Del=3
mu2=mu1 Del
components <- sample(1:2,prob=c((1-lbda), lbda),size=N,replace=TRUE)
mus <- c(mu1,mu2)
sds <- sqrt(c(1,.5))
Y <- rlnorm(n=N,meanlog=mus[components],sdlog=sds[components])
mixfit()然后我嘗試使用from將兩個對數法線擬合到此資料中mixR。在第一次嘗試中,我嘗試使用包中的plot()功能base;但plot忽略了xlim論點。
mod4 <- mixfit(Y, ncomp = 2, family = 'lnorm')
plot(mod4, title = 'Log-Normal Mixture (2 components)', xlim=c(0,200))
然后我嘗試使用 ggplot 進行繪圖,根據
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/493116.html
