R version 2.9.2 (2009-08-24)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>
> X = c(4,5,2,8,3.4,1)
> Y = c(3,7,5)
>
> # Join the vectors together
>
> Z = c(X, Y)
> dummy = c(1,1,1,1,1,1,0,0,0)
>
> print(summary(lm(Z ~ dummy)))

Call:
lm(formula = Z ~ dummy)

Residuals:
Min 1Q Median 3Q Max
-2.900e+00 -1.900e+00 2.114e-16 1.100e+00 4.100e+00

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.000 1.350 3.702 0.00763 **
dummy -1.100 1.654 -0.665 0.52731
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.339 on 7 degrees of freedom
Multiple R-squared: 0.05943, Adjusted R-squared: -0.07494
F-statistic: 0.4423 on 1 and 7 DF, p-value: 0.5273

> print(confint(lm(Z ~ dummy)))
2.5 % 97.5 %
(Intercept) 1.806611 8.193389
dummy -5.011087 2.811087
> print(t.test(X,Y,var.equal=T))

Two Sample t-test

data: X and Y
t = -0.6651, df = 7, p-value = 0.5273
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-5.011087 2.811087
sample estimates:
mean of x mean of y
3.9 5.0

>

>
> proc.time()
user system elapsed
0.540 0.032 0.560
R script