Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:58:39+00:00 2026-06-15T02:58:39+00:00

I understand the contrasts from previous posts and I think I am doing the

  • 0

I understand the contrasts from previous posts and I think I am doing the right thing but it is not giving me what I would expect.

x <- c(11.80856, 11.89269, 11.42944, 12.03155, 10.40744,
       12.48229, 12.1188, 11.76914, 0, 0,
       13.65773, 13.83269, 13.2401, 14.54421, 13.40312)
type <- factor(c(rep("g",5),rep("i",5),rep("t",5)))
type
 [1] g g g g g i i i i i t t t t t
Levels: g i t

When I run this:

> summary.lm(aov(x ~ type))

Call:
aov(formula = x ~ type)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.2740 -0.4140  0.0971  0.6631  5.2082 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   11.514      1.729   6.659 2.33e-05 ***
typei         -4.240      2.445  -1.734    0.109    
typet          2.222      2.445   0.909    0.381    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 3.866 on 12 degrees of freedom
Multiple R-squared: 0.3753,     Adjusted R-squared: 0.2712 
F-statistic: 3.605 on 2 and 12 DF,  p-value: 0.05943 

Here my reference is my type “g”, so my typei is the difference between type “g” and type “i”, and my typet is the difference between type “g” and type “t”.

I wanted to see two more contrasts here, the difference between typei+typeg and type “t” and difference between type “i” and type “t”

so the contrasts

> contrasts(type) <- cbind( c(-1,-1,2),c(0,-1,1))
> summary.lm(aov(x~type))

Call:
aov(formula = x ~ type)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.2740 -0.4140  0.0971  0.6631  5.2082 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  10.8412     0.9983  10.860 1.46e-07 ***
type1        -0.6728     1.4118  -0.477    0.642    
type2         4.2399     2.4453   1.734    0.109    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 3.866 on 12 degrees of freedom
Multiple R-squared: 0.3753,     Adjusted R-squared: 0.2712 
F-statistic: 3.605 on 2 and 12 DF,  p-value: 0.05943 

When I try to do the second contrast by changing my reference I get different results. I am not understanding what is wrong with my contrast.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:58:40+00:00Added an answer on June 15, 2026 at 2:58 am

    Refence: http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm

    mat <- cbind(rep(1/3, 3), "g+i vs t"=c(-1/2, -1/2, 1),"i vs t"=c(0, -1, 1))
    mymat <- solve(t(mat))
    my.contrast <- mymat[,2:3]
    contrasts(type) <- my.contrast
    summary.lm(aov(x ~ type))
    
    my.contrast
    >      g+i vs t i vs t
    [1,]  -1.3333      1
    [2,]   0.6667     -1
    [3,]   0.6667      0
    > contrasts(type) <- my.contrast
    > summary.lm(aov(x ~ type))
    
    Call:
    aov(formula = x ~ type)
    
    Residuals:
       Min     1Q Median     3Q    Max 
    -7.274 -0.414  0.097  0.663  5.208 
    
    Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
    (Intercept)    10.841      0.998   10.86  1.5e-07 ***
    typeg+i vs t    4.342      2.118    2.05    0.063 .  
    typei vs t      6.462      2.445    2.64    0.021 *  
    ---
    Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
    
    Residual standard error: 3.87 on 12 degrees of freedom
    Multiple R-squared: 0.375,  Adjusted R-squared: 0.271 
    F-statistic:  3.6 on 2 and 12 DF,  p-value: 0.0594 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

below content is taken from Best practice: Writing efficient code but i didn't understand
I understand this is a basic topic but never done this before starting from
I understand, from MSDN, that ClassInitialize is to mark a method that will do
I understand this is an easy question but for some reason this just isn't
I understand what weak tables are. But I'd like to know where weak tables
From what I understand: If you don't have a MEX endpoint / WSDL, your
I am struggling to understand what I am doing wrong. I have a simple
I'm tying to understand Code Contracts advantages. I've wrote following code (from PEX +
Very new to AJAX, but have learned a bit from online tutorials. If I
I wanna launch the Contacts application from my application Activity. I am not able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.