Color in F Distribution

Hi All,
I have a question regarding the Graphic in F distribution.
This is my code:

xp = seq(0, 5, length = 100)
y=df(x=xp,df1=1,df2=44)
curve(df(x, df1=1, df2=44), from=0, to=5, main="Distribucion F")

All is ok in this code. But I would like to mark the rejection zone in color blue.
My F critical is 4.061
I tried to do it using polygon function but I could not do it well.
polygon(c(F.critico,xp,5), c(0,y,0) ,col="blue")

Could you help me with this, please?.
Many Thanks in Advance.
Luciano

Is this what you want?

xp = seq(0, 5, length = 100)
y=df(x=xp,df1=1,df2=44)
curve(df(x, df1=1, df2=44), from=0, to=5, main="Distribucion F")
F.critico=4.061
polygon(c(F.critico, F.critico, xp[xp>F.critico], max(xp)),
        c(0, df(F.critico, df1=1, df2=44), y[xp>F.critico], 0),
        col = "blue")

Created on 2020-12-06 by the reprex package (v0.3.0)

If this is right, the change is for your polygon you only need to specify the x values which fall in critical region.

Yes Yarnavrina.
Many Thanks for you reply.
:slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.