1

I'm new to simulating data in R and would like to know how to generate a polynomial separator of degree 2 in R. This is the question:

Generate a Data Set by Simulations: We seek to generate 5000 cases x^1 ... x^5000 in R^4

each case x = [ x1 x2 x3 x4 ] has 4 numerical features.

using random sampling of a uniform distribution over the interval [-2, +2]: select 16 random numbers Aij with i= 1 2 3 4 and j = 1 2 3 4; select 4 random numbers Bi with i= 1 2 3 4; select 1 random number c

Define the polynomial of degree 2 in the 4 variables x1 x2 x3 x4 as follows:

Pol(x) = ∑i ∑j Aij xi xj + ∑i Bi xi + c/20

so far I've generated A, B, and C:

A <- matrix(runif(16, -2, 2), nrow=4, ncol=4)
B <- runif(4, -2, 2)
C <- runif(1, -2, 2)

But I'm having trouble finding out how to define a polynomial using the values I generated.

vdu12345
  • 73
  • 1
  • 8

0 Answers0