In [1]:
print "testing python kernel"


testing python kernel

In [2]:
import rpy2

In [9]:
import rpy2.ipython

In [3]:
%load_ext rpy2.ipython

In [4]:
import numpy as np

In [5]:
X = np.array([0,1,2,3,4])
Y = np.array([3,5,4,6,7])

In [6]:
%%R -i X,Y -o XYcoef
XYlm = lm(Y~X)
XYcoef = coef(XYlm)
print(summary(XYlm))
par(mfrow=c(2,2))
plot(XYlm)


Call:
lm(formula = Y ~ X)

Residuals:
   1    2    3    4    5 
-0.2  0.9 -1.0  0.1  0.2 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept)   3.2000     0.6164   5.191   0.0139 *
X             0.9000     0.2517   3.576   0.0374 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.7958 on 3 degrees of freedom
Multiple R-squared:   0.81,	Adjusted R-squared:  0.7467 
F-statistic: 12.79 on 1 and 3 DF,  p-value: 0.03739


In [7]:
np.arange(4, 6, 0.5)


Out[7]:
array([ 4. ,  4.5,  5. ,  5.5])

In [8]:
np.arange(4,6)


Out[8]:
array([4, 5])