Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset) I need the p-values for the coefficients printed by calling "fit". fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors help files don't seem to give me a function that extracts them. Yet, they are calculated and printed, based on the Wald statistics. So they must be reachable. Anybody knows how? Thank you in advance Kind regards Joris
Obtaining p-values for coefficients from LRM function (package Design) - plaintext
6 messages · David Winsemius, Joris Meys, Frank E Harrell Jr
joris meys wrote:
Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset) I need the p-values for the coefficients printed by calling "fit".
The individual p-values are not very meaningful. anova(fit) returns a matrix of meaningful tests with P-values. Frank
fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors help files don't seem to give me a function that extracts them. Yet, they are calculated and printed, based on the Wald statistics. So they must be reachable. Anybody knows how? Thank you in advance Kind regards Joris
______________________________________________ R-help at 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.
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
On Dec 13, 2008, at 1:12 PM, joris meys wrote:
Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset)
That link could create a montrous interpretation problem.
I need the p-values for the coefficients printed by calling "fit". fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors
If you want to see how Harrell does it, you can work through the code
that you get from:
print.lrm
The last element in the "stats" list is (1 - pchisq(z^2, 1), 4) )
where z was defined as
z <- cof/sqrt(vv)
... and those were obtained further up as:
vv <- diag(x$var)
cof <- x$coef
So you could try seeing if this is satisfying:
vv <- diag(fit$var) ;
cof <- fit$coef ;
z <- cof/sqrt(vv) ;
1 - pchisq(z^2, 1)
David Winsemius > > > help files don't seem to give me a function that extracts them. Yet, > they are calculated and printed, based on the Wald statistics. So they > must be reachable. > > Anybody knows how? > > Thank you in advance > Kind regards > Joris > > ______________________________________________ > R-help at 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.
Thanks for the answers. @David : I am aware of that, but this is far from the last model actually. @ Frank : I know the Anova procedure gives more relevant p-values, but the attempt is to order the terms by interaction type from low significance to high significance, based on their individual difference from zero (if I'm making any sense here). I use this merely as a quick guideline for model selection, the Anova I use later on for model evaluation. Therefore I would like to substract the p-values, as they're easier to interprete in that respect than the anova values. Or am I missing something? Kind regards Joris
On Sat, Dec 13, 2008 at 8:44 PM, David Winsemius <dwinsemius at comcast.net> wrote:
On Dec 13, 2008, at 1:12 PM, joris meys wrote:
Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset)
That link could create a montrous interpretation problem.
I need the p-values for the coefficients printed by calling "fit". fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors
If you want to see how Harrell does it, you can work through the code that you get from: print.lrm The last element in the "stats" list is (1 - pchisq(z^2, 1), 4) ) where z was defined as z <- cof/sqrt(vv) ... and those were obtained further up as: vv <- diag(x$var) cof <- x$coef So you could try seeing if this is satisfying: vv <- diag(fit$var) ; cof <- fit$coef ; z <- cof/sqrt(vv) ; 1 - pchisq(z^2, 1) -- David Winsemius
help files don't seem to give me a function that extracts them. Yet, they are calculated and printed, based on the Wald statistics. So they must be reachable. Anybody knows how? Thank you in advance Kind regards Joris
______________________________________________ R-help at 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.
To clarify : I am aware of the interpretation problems. Thank you for the tip! (it's getting late here...)
On Sat, Dec 13, 2008 at 9:56 PM, joris meys <jorismeys at gmail.com> wrote:
Thanks for the answers. @David : I am aware of that, but this is far from the last model actually. @ Frank : I know the Anova procedure gives more relevant p-values, but the attempt is to order the terms by interaction type from low significance to high significance, based on their individual difference from zero (if I'm making any sense here). I use this merely as a quick guideline for model selection, the Anova I use later on for model evaluation. Therefore I would like to substract the p-values, as they're easier to interprete in that respect than the anova values. Or am I missing something? Kind regards Joris On Sat, Dec 13, 2008 at 8:44 PM, David Winsemius <dwinsemius at comcast.net> wrote:
On Dec 13, 2008, at 1:12 PM, joris meys wrote:
Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset)
That link could create a montrous interpretation problem.
I need the p-values for the coefficients printed by calling "fit". fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors
If you want to see how Harrell does it, you can work through the code that you get from: print.lrm The last element in the "stats" list is (1 - pchisq(z^2, 1), 4) ) where z was defined as z <- cof/sqrt(vv) ... and those were obtained further up as: vv <- diag(x$var) cof <- x$coef So you could try seeing if this is satisfying: vv <- diag(fit$var) ; cof <- fit$coef ; z <- cof/sqrt(vv) ; 1 - pchisq(z^2, 1) -- David Winsemius
help files don't seem to give me a function that extracts them. Yet, they are calculated and printed, based on the Wald statistics. So they must be reachable. Anybody knows how? Thank you in advance Kind regards Joris
______________________________________________ R-help at 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.
joris meys wrote:
Thanks for the answers. @David : I am aware of that, but this is far from the last model actually. @ Frank : I know the Anova procedure gives more relevant p-values, but the attempt is to order the terms by interaction type from low significance to high significance, based on their individual difference from zero (if I'm making any sense here). I use this merely as a quick guideline for model selection, the Anova I use later on for model evaluation.
Be sure to use the hierarchy principle, which anova.Design respects. Beware of doing model selection on the basis of P-values, R-square, partial R-square, AIC, BIC, regression coefficients, or Mallows' Cp. Frank
Therefore I would like to substract the p-values, as they're easier to interprete in that respect than the anova values. Or am I missing something? Kind regards Joris On Sat, Dec 13, 2008 at 8:44 PM, David Winsemius <dwinsemius at comcast.net> wrote:
On Dec 13, 2008, at 1:12 PM, joris meys wrote:
Sent this mail in rich text format before. Excuse me for this. ------------------------ Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset)
That link could create a montrous interpretation problem.
I need the p-values for the coefficients printed by calling "fit". fit$coef (gives a list of only the coefficients) fit$pval, fit$p, fit$pvalue, fit$p.value,... : nothing works str(fit) : no hints there fit[1,4] : gives dimension errors
If you want to see how Harrell does it, you can work through the code that you get from: print.lrm The last element in the "stats" list is (1 - pchisq(z^2, 1), 4) ) where z was defined as z <- cof/sqrt(vv) ... and those were obtained further up as: vv <- diag(x$var) cof <- x$coef So you could try seeing if this is satisfying: vv <- diag(fit$var) ; cof <- fit$coef ; z <- cof/sqrt(vv) ; 1 - pchisq(z^2, 1) -- David Winsemius
help files don't seem to give me a function that extracts them. Yet, they are calculated and printed, based on the Wald statistics. So they must be reachable. Anybody knows how? Thank you in advance Kind regards Joris
______________________________________________ R-help at 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 at 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.
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University