R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

Akhmad Badawi_210605110086

y <- c (32, 36, 27, 34, 28, 29, 39, 29, 28, 26, 38, 39)
X1 <-c(57, 59, 49, 62, 51, 50, 55, 48, 42, 42, 61, 57)
X2 <- c(8, 10, 6, 11, 8, 7, 10, 9, 10, 6, 12, 9)
length(y)
## [1] 12
length(X1)
## [1] 12
length(X2)
## [1] 12
g <- lm(y ~ X1 + X2)
 summary(g)
## 
## Call:
## lm(formula = y ~ X1 + X2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.9166 -1.1626 -0.4743  0.4228  4.9709 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   1.9393     6.8470   0.283   0.7834  
## X1            0.4231     0.1632   2.593   0.0291 *
## X2            0.8861     0.5863   1.511   0.1650  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.915 on 9 degrees of freedom
## Multiple R-squared:  0.7113, Adjusted R-squared:  0.6471 
## F-statistic: 11.09 on 2 and 9 DF,  p-value: 0.003733
anova(g)
## Analysis of Variance Table
## 
## Response: y
##           Df  Sum Sq Mean Sq F value   Pr(>F)   
## X1         1 169.025 169.025 19.8898 0.001578 **
## X2         1  19.409  19.409  2.2839 0.165005   
## Residuals  9  76.483   8.498                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1