[R] FW: multivariate regression

Deniz SIGIRLI
Mon, 07 Feb 2011 10:24:26 -0000

The test is manova. I tried to use manova() function,  I used the code below:fit
<- manova(Y ~ X)summary(fit, test="Wilks")but I get p values for
intercept and regression coefficient as in anova() function, not for the hull
model.

Date: Mon, 7 Feb 2011 00:57:43 -0800
Subject: Re: [R] FW: multivariate regression
From: djmuser@gmail.com
To: denizsigirli@hotmail.com
CC: r-help@r-project.org

Hi:

You don't state the test for which you want the p-value, and to reiterate
what Dr. Ligges asked in response to your earlier post, how do you propose to
define a single R^2 measure? One may be able to answer your question re an
overall significance test using the anova() function:


>
Y<-matrix(c(3,5,6,3,4,2,4,5,3,2,3,5,6,3,4,2,4,5,3,2,3,5,6,3,4,2,4,5,3,2),
nrow = 10, ncol=3, byrow=TRUE)
> X1<-matrix(c(42,54,67,76,45,76,54,87,34,65), nrow = 10, ncol=1,
byrow=TRUE)X2<-matrix(c(38,21,67,76,45,76,54,87,34,65), nrow = 10, ncol=1,
byrow=TRUE)
> m <- lm(Y~X)

> anova(m)     # Default is Pillai's trace
Analysis of Variance Table

            Df  Pillai approx F num Df den Df    Pr(>F)
(Intercept)  1 0.97219   69.917      3      6 4.656e-05 ***
X            1 0.36415    1.145      3      6    0.4041

Residuals    8
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

> anova(m, test = 'Wilks')    # Wilks' lambda
Analysis of Variance Table


            Df   Wilks approx F num Df den Df    Pr(>F)
(Intercept)  1 0.02781   69.917      3      6 4.656e-05 ***
X            1 0.63585    1.145      3      6    0.4041
Residuals    8

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Roy's maximum root test and the Lawley-Hotelling statistic can also be
applied by using 'Roy' or 'Hotelling' as the value of the test =
argument of anova.lm().


HTH,
Dennis

On Sun, Feb 6, 2011 at 11:08 PM, Deniz SIGIRLI <denizsigirli@hotmail.com>
wrote:





#I have got 3 dependent variables:



Y<-matrix(c(3,5,6,3,4,2,4,5,3,2,3,5,6,3,4,2,4,5,3,2,3,5,6,3,4,2,4,5,3,2),
nrow = 10, ncol=3, byrow=TRUE)

#I've got one independent variable:



X<-matrix(c(42,54,67,76,45,76,54,87,34,65), nrow = 10, ncol=1, byrow=TRUE)

summary(lm(Y~X))





and the result is as below:

 Response Y1 :



Call:

lm(formula = Y1 ~ X)



Residuals:

    Min      1Q  Median      3Q     Max

-1.5040 -0.8838 -0.3960  1.1174  2.1162



Coefficients:

            Estimate Std. Error t value Pr(>|t|)

(Intercept)  4.43507    1.70369   2.603   0.0315 *

X           -0.01225    0.02742  -0.447   0.6668

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1



Residual standard error: 1.401 on 8 degrees of freedom

Multiple R-squared: 0.02435,    Adjusted R-squared: -0.09761

F-statistic: 0.1997 on 1 and 8 DF,  p-value: 0.6668





Response Y2 :



Call:

lm(formula = Y2 ~ X)



Residuals:

    Min      1Q  Median      3Q     Max

-1.4680 -0.8437 -0.2193  0.9050  1.9960



Coefficients:

            Estimate Std. Error t value Pr(>|t|)

(Intercept)  1.37994    1.50111   0.919    0.385

X            0.03867    0.02416   1.601    0.148



Residual standard error: 1.235 on 8 degrees of freedom

Multiple R-squared: 0.2426,     Adjusted R-squared: 0.1479

F-statistic: 2.562 on 1 and 8 DF,  p-value: 0.1481





Response Y3 :



Call:

lm(formula = Y3 ~ X)



Residuals:

    Min      1Q  Median      3Q     Max

-1.7689 -0.7316 -0.1943  1.1448  2.0933



Coefficients:

            Estimate Std. Error t value Pr(>|t|)

(Intercept)  4.38913    1.70626   2.572    0.033 *

X           -0.01149    0.02746  -0.418    0.687

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1



Residual standard error: 1.403 on 8 degrees of freedom

Multiple R-squared: 0.0214,     Adjusted R-squared: -0.1009

F-statistic: 0.175 on 1 and 8 DF,  p-value: 0.6867







There are 3 F statistics, R2 and p-values. But I want just one R2 and pvalue for
my multivariate regression model.



















> Date: Fri, 4 Feb 2011 08:23:39 -0500

> From: jsorkin@grecc.umaryland.edu

> To: denizsigirli@hotmail.com; r-help@r-project.org

> Subject: Re: [R] multivariate regression

>

> Please help us help you. Follow the posting rules and send us a copy of
your code and output.

> John

> John Sorkin

> Chief Biostatistics and Informatics

> Univ. of Maryland School of Medicine

> Division of Gerontology and Geriatric Medicine

> JSorkin@grecc.umaryland.edu

> -----Original Message-----

> From: Deniz SIGIRLI <denizsigirli@hotmail.com>

> To: <r-help@r-project.org>

>

> Sent: 2/4/2011 7:54:56 AM

> Subject: [R] multivariate regression

>

>

> How can I run multivariate linear regression in R (I have got 3 dependent
variables and only 1 independent variable)? I tried lm function, but it gave
different R2 and p values for every dependent variable. I need one R2 and p
value for the model.


> [[alternative HTML version deleted]]

>

> ______________________________________________

> 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.

>

> Confidentiality Statement:

> This email message, including any attachments, is for ...{{dropped:22}}