Re: [R] F Distribution
qf() (as you might have figured from the help page for pf()) -pd > On 21 Dec 2015, at 20:51 , Robert Sherry wrote: > > > When I use a table, from a Schaum book, I see that for the 95 percentile, > with v_1 = 1 and v_2 = 1 the value is 161. In the modern era, > looking values up in a table is less than ideal. Therefore, I would expect R > to have a function to do this and based upon my > reading of the documentation, I would expect the following call to get the > value I expect: > pf( .95,1, 1) > However, it produces >0.4918373 > Therefore, I conclude that I am using the wrong function. What function > should I use? > > Thanks > Bob > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F Distribution
You want to use qf which gives you the value at a given percentile. pf gives you the p-value for a given value of F (inverse) > qf(0.95, 1, 1) [1] 161.4476 > pf(161.4476, 1, 1) [1] 0.95 Peter On Mon, Dec 21, 2015 at 11:51 AM, Robert Sherry wrote: > > When I use a table, from a Schaum book, I see that for the 95 percentile, > with v_1 = 1 and v_2 = 1 the value is 161. In the modern era, > looking values up in a table is less than ideal. Therefore, I would expect R > to have a function to do this and based upon my > reading of the documentation, I would expect the following call to get the > value I expect: > pf( .95,1, 1) > However, it produces > 0.4918373 > Therefore, I conclude that I am using the wrong function. What function > should I use? > > Thanks > Bob > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F Distribution
Dear Bob, You want... > qf( .95,1, 1) [1] 161.4476 Best, Fraser -Original Message- From: Robert Sherry [mailto:rsher...@comcast.net] Sent: Monday, December 21, 2015 2:51 PM To: R Project Help Subject: [R] F Distribution When I use a table, from a Schaum book, I see that for the 95 percentile, with v_1 = 1 and v_2 = 1 the value is 161. In the modern era, looking values up in a table is less than ideal. Therefore, I would expect R to have a function to do this and based upon my reading of the documentation, I would expect the following call to get the value I expect: pf( .95,1, 1) However, it produces 0.4918373 Therefore, I conclude that I am using the wrong function. What function should I use? Thanks Bob __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] F Distribution
When I use a table, from a Schaum book, I see that for the 95 percentile, with v_1 = 1 and v_2 = 1 the value is 161. In the modern era, looking values up in a table is less than ideal. Therefore, I would expect R to have a function to do this and based upon my reading of the documentation, I would expect the following call to get the value I expect: pf( .95,1, 1) However, it produces 0.4918373 Therefore, I conclude that I am using the wrong function. What function should I use? Thanks Bob __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F distribution from lme()?
Dear Bill Venables, Does this mean that in a conventional aov object, the "summary.lm" gives the parameter estimates and p-values computed "marginally", while the "summary.aov" table by default gives sequential sums of squares? This question arose recently when a colleague and I were discussing differences in the P-values from a model that contained only linear (1 d.f.) terms. Thanks a lot for your assistance, Christoph. [EMAIL PROTECTED] schrieb: > Using anova with the default setting generates a sequential analysis of > variance table. You can see this by noting that if you change the order > of terms in the model, it gives you a different result: > >> incub.lme2 <- lme(egg.temp ~ kjday + treat, random = ~1|ind, data = > incub.df) >> incub.lme3 <- lme(egg.temp ~ treat + kjday, random = ~1|ind, data = > incub.df) >> anova(incub.lme2) > numDF denDF F-value p-value > (Intercept) 111 1176.6677 <.0001 > kjday 1 75.7060 0.0483 > treat 1 79.6364 0.0172 >> anova(incub.lme3) > numDF denDF F-value p-value > (Intercept) 111 1176.6677 <.0001 > treat 1 7 14.8398 0.0063 > kjday 1 70.5026 0.5013 > > So this is adressing the question of what the additional contribution of > each term is if you add them to the model one after the other. If you > look at kjday *before* you consider the effect of treat, it looks very > significant, but if you allow for the effect of treat and then consider > the additional contribution of kjday, it looks unnecessary. This is a > sure sign that treat and kjday (at least) are partially confounded in > the data, and if you look closely at the data itself you can see this. > > What you were expecting is an anova output which is not additive, but > considers the contribution of each term separately, with all other terms > in the model. This is called a "marginal" anova table, for which you > can ask: > >> anova(incub.lme3, type = "marginal") > numDF denDF F-value p-value > (Intercept) 111 21.664654 0.0007 > treat 1 7 9.636384 0.0172 > kjday 1 7 0.502597 0.5013 > > Notice that dropterm(...) from the MASS library can be used for the same > kind of table for simpler LM and GLM models. > > Bill Venables. > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Andreas Nord > Sent: Thursday, 1 November 2007 5:17 PM > To: r-help@r-project.org > Subject: [R] F distribution from lme()? > > > Dear all, > > Using the data set and code below, I am interested in modelling how egg > temperature (egg.temp) > is related to energy expenditure (kjday) and clutch size (treat) in > incubating birds using the > lme-function. I wish to generate the F-distribution for my model, and > have > tried to do so using > the anova()-function. However, in the resulting anova-table, the > parameter > kjday has gone from > being highly non-signiicant in the lme-expression, to all of a sudden > being > significant at the > 0.05 level. At the same time, "treat" retains its original p-value. I've > tried to understand why, > but can't really figure it out. So, what has happened and why? How to > best > interpret it? > > Further, any advice on how to best generate F-distributions from the > lme-function is most appreciated. > > Many thanks in advance, > Andreas Nord > Sweden > > > ind treat egg.temp kjday >79 2 27.33241 42.048 >42 2 30.73269 41.760 >10 2 29.54986 38.304 > 206 2 31.78947 45.216 >23 2 29.69114 40.896 >24 2 36.48199 46.944 >45 2 29.76454 44.064 >29 2 30.56510 42.912 >78 2 27.71468 43.200 >79 3 25.88227 45.216 >42 3 30.95983 44.640 >10 3 28.13296 45.216 > 206 3 31.77147 45.216 >23 3 27.5 42.336 > 5 3 28.16205 51.264 >24 3 34.69391 48.960 >45 3 28.79778 46.368 > 368 3 26.18006 45.792 >29 3 29.75208 45.216 >78 3 25.28393 43.200 >44 3 23.32825 44.640 > > > # lme-model with "individual" as random factor >> incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df) > > Fixed effects: egg.temp ~ kjday + treat > Value Std.Error DF t-value p-value > (Intercept) 24.937897 6.662475 11 3.743038 0.0032 > kjday0.108143 0.152540 7 0.708945 0.5013 > treat3 -1.506605 0.485336 7 -3.104254 0.0172 > > > #generating an an
Re: [R] F distribution from lme()?
Using anova with the default setting generates a sequential analysis of variance table. You can see this by noting that if you change the order of terms in the model, it gives you a different result: > incub.lme2 <- lme(egg.temp ~ kjday + treat, random = ~1|ind, data = incub.df) > incub.lme3 <- lme(egg.temp ~ treat + kjday, random = ~1|ind, data = incub.df) > > anova(incub.lme2) numDF denDF F-value p-value (Intercept) 111 1176.6677 <.0001 kjday 1 75.7060 0.0483 treat 1 79.6364 0.0172 > anova(incub.lme3) numDF denDF F-value p-value (Intercept) 111 1176.6677 <.0001 treat 1 7 14.8398 0.0063 kjday 1 70.5026 0.5013 So this is adressing the question of what the additional contribution of each term is if you add them to the model one after the other. If you look at kjday *before* you consider the effect of treat, it looks very significant, but if you allow for the effect of treat and then consider the additional contribution of kjday, it looks unnecessary. This is a sure sign that treat and kjday (at least) are partially confounded in the data, and if you look closely at the data itself you can see this. What you were expecting is an anova output which is not additive, but considers the contribution of each term separately, with all other terms in the model. This is called a "marginal" anova table, for which you can ask: > anova(incub.lme3, type = "marginal") numDF denDF F-value p-value (Intercept) 111 21.664654 0.0007 treat 1 7 9.636384 0.0172 kjday 1 7 0.502597 0.5013 > Notice that dropterm(...) from the MASS library can be used for the same kind of table for simpler LM and GLM models. Bill Venables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Nord Sent: Thursday, 1 November 2007 5:17 PM To: r-help@r-project.org Subject: [R] F distribution from lme()? Dear all, Using the data set and code below, I am interested in modelling how egg temperature (egg.temp) is related to energy expenditure (kjday) and clutch size (treat) in incubating birds using the lme-function. I wish to generate the F-distribution for my model, and have tried to do so using the anova()-function. However, in the resulting anova-table, the parameter kjday has gone from being highly non-signiicant in the lme-expression, to all of a sudden being significant at the 0.05 level. At the same time, "treat" retains its original p-value. I've tried to understand why, but can't really figure it out. So, what has happened and why? How to best interpret it? Further, any advice on how to best generate F-distributions from the lme-function is most appreciated. Many thanks in advance, Andreas Nord Sweden ind treat egg.temp kjday 79 2 27.33241 42.048 42 2 30.73269 41.760 10 2 29.54986 38.304 206 2 31.78947 45.216 23 2 29.69114 40.896 24 2 36.48199 46.944 45 2 29.76454 44.064 29 2 30.56510 42.912 78 2 27.71468 43.200 79 3 25.88227 45.216 42 3 30.95983 44.640 10 3 28.13296 45.216 206 3 31.77147 45.216 23 3 27.5 42.336 5 3 28.16205 51.264 24 3 34.69391 48.960 45 3 28.79778 46.368 368 3 26.18006 45.792 29 3 29.75208 45.216 78 3 25.28393 43.200 44 3 23.32825 44.640 # lme-model with "individual" as random factor > incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df) Fixed effects: egg.temp ~ kjday + treat Value Std.Error DF t-value p-value (Intercept) 24.937897 6.662475 11 3.743038 0.0032 kjday0.108143 0.152540 7 0.708945 0.5013 treat3 -1.506605 0.485336 7 -3.104254 0.0172 #generating an anova table to get the F-distribution > anova(incub.lme2) numDF denDF F-value p-value (Intercept) 111 1176.6686 <.0001 kjday 1 75.7060 0.0483 treat 1 79.6364 0.0172 > -- View this message in context: http://www.nabble.com/F-distribution-from-lme%28%29--tf4729757.html#a135 24346 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F distribution from lme()?
Dear Andreas, try: anova(incub.lme2, type="marginal") Read more about marginal vs. sequential tests in the help page ?anova.lme. Christian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] F distribution from lme()?
Dear all, Using the data set and code below, I am interested in modelling how egg temperature (egg.temp) is related to energy expenditure (kjday) and clutch size (treat) in incubating birds using the lme-function. I wish to generate the F-distribution for my model, and have tried to do so using the anova()-function. However, in the resulting anova-table, the parameter kjday has gone from being highly non-signiicant in the lme-expression, to all of a sudden being significant at the 0.05 level. At the same time, "treat" retains its original p-value. I've tried to understand why, but can't really figure it out. So, what has happened and why? How to best interpret it? Further, any advice on how to best generate F-distributions from the lme-function is most appreciated. Many thanks in advance, Andreas Nord Sweden ind treat egg.temp kjday 79 2 27.33241 42.048 42 2 30.73269 41.760 10 2 29.54986 38.304 206 2 31.78947 45.216 23 2 29.69114 40.896 24 2 36.48199 46.944 45 2 29.76454 44.064 29 2 30.56510 42.912 78 2 27.71468 43.200 79 3 25.88227 45.216 42 3 30.95983 44.640 10 3 28.13296 45.216 206 3 31.77147 45.216 23 3 27.5 42.336 5 3 28.16205 51.264 24 3 34.69391 48.960 45 3 28.79778 46.368 368 3 26.18006 45.792 29 3 29.75208 45.216 78 3 25.28393 43.200 44 3 23.32825 44.640 # lme-model with "individual" as random factor > incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df) Fixed effects: egg.temp ~ kjday + treat Value Std.Error DF t-value p-value (Intercept) 24.937897 6.662475 11 3.743038 0.0032 kjday0.108143 0.152540 7 0.708945 0.5013 treat3 -1.506605 0.485336 7 -3.104254 0.0172 #generating an anova table to get the F-distribution > anova(incub.lme2) numDF denDF F-value p-value (Intercept) 111 1176.6686 <.0001 kjday 1 75.7060 0.0483 treat 1 79.6364 0.0172 > -- View this message in context: http://www.nabble.com/F-distribution-from-lme%28%29--tf4729757.html#a13524346 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.