0
我是R和統計學的新手,我仍然理解基本概念。我需要根據高斯曲線創建一列矩陣中所有值的圖形。 下面是代碼對高斯曲線的繪圖值
#Generates a random matrix with 50 columns
randomMatrix1 <- matrix(c(1:30000), ncol=50)
#Base sequence
x <- seq(15001,30000, 25)
#Normal function using mean and sd of randomMatrix1
y1 <- dnorm(x/1000,mean=mean(randomMatrix1[,50]),sd=sd(randomMatrix1[,50]))
#Getting the actual values in randomMatrix1
y2 <- cbind(randomMatrix1[,50]/1000)
df <- data.frame(x,y1,y2)
require(ggplot2)
ggplot(df, aes(x)) + # basic graphical object
geom_line(aes(y=y1), colour="red") + # first layer
geom_line(aes(y=y2), colour="green") # second layer
我需要同積兩個地塊的輸出,但輸出不進行縮放,我嘗試不同的均值和SD但是毫無效果的某種組合。
我知道這一定是一個非常基本的問題,但是我應該更改哪個參數,這樣兩個圖可以縮放並顯示在一起。
我會幫但我不知道是什麼'meanMat'或'stdDev'以上。 – N8TRO 2013-02-21 06:26:53
我的不好。這是一個錯字。現在修復它。 – user2085566 2013-02-21 06:39:22