| Download
Github repo cloud-examples: https://github.com/sagemath/cloud-examples
Project: Support and Testing
Views: 8116License: MIT
R Basics
Just a demo, how R can be called from Sage to do something useful.
R Interpreter
[1] 1.0 2.0 3.0 -1.0 2.0 2.2
<class 'sage.interfaces.r.RElement'>
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.000 1.250 2.000 1.533 2.150 3.000
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.000 2.500 3.000 3.091 3.500 6.000
[1] 1
[1] 4
[1] 5 5 -2 5 -5 -4 -3 -4 1 -1 -1 -3 0 0 -2 1 -4 -2 -2 -2 -5 -5 -4 1 1 4 -2 -1 0 -4
Min. 1st Qu. Median Mean 3rd Qu. Max.
-5.00 -3.75 -2.00 -1.10 0.75 5.00
[1] 0 4 -1 -5 2 -2 -3 -4 3 1
Linear Regression
Call:
lm(formula = Y ~ X)
Residuals:
Min 1Q Median 3Q Max
-9.8958 -3.1144 -0.4075 2.8230 12.4266
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.6632 0.4948 -3.361 0.00111 **
X 1.3158 0.1904 6.909 4.94e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 4.945 on 98 degrees of freedom
Multiple R-squared: 0.3276, Adjusted R-squared: 0.3207
F-statistic: 47.74 on 1 and 98 DF, p-value: 4.941e-10