Ask Your Question
1

Use R result

asked 2018-01-14 15:42:32 -0600

dg.aragones gravatar image

updated 2018-01-14 20:13:09 -0600

Hi!

I'm new in Sagemath, but I've some experience using R. For example, if I want to generate 100 random numbers from a Bernoulli distribution, I can use the code:

r.rbinom(n=100,size=1,prob=0.25)

But... Is there any way to use the result for another operation in Sagemath? And results related to a linear regression, a given test or a plot (done with R)? May it be more efficient to use Scipy in a general workflow?

Thanks for your answers!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-01-14 17:27:13 -0600

tmonteil gravatar image

updated 2018-01-14 17:27:45 -0600

In this case, you can just call the sage method:

sage: a = r.rbinom(n=100,size=1,prob=0.25)
sage: a
  [1] 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0
 [48] 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1
 [95] 0 0 1 0 0 0
sage: L = a.sage()
sage: L
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-01-14 15:42:32 -0600

Seen: 49 times

Last updated: Jan 14