This is a linear regression problem for pastry rating. I want to add a color to the mix. How does adding a color effect the rating?

Here are the colors:
YYRPYRRPPPRRPPYY

Here is the full context:
Assume in the pastry rating, that pastry samples

have different colors, and we also would like to asses the
effect of color (Yellow, Red, or Purple) on the rating.
Assume that the 16 samples have colors
YYRPYRRPPPRRPPYY in the order they appear in the
data set.
I have done some work already, but it is not yielding the results I want. Please help me. I have attached the work I have done thus far. Is it a mistake I am making in the dat file, or are they not being defined properly in the mod file?

SAHC-hw10.mod (760 Bytes)

SAHC-hw10.dat (481 Bytes)

In your data table for “param data {SAMPLES,NAMES}”, you have

param data:
rate moist sweet color :=
1 64 4 'Y'
2 73 4 'Y'
3 61 4 'R'
.....

After the := each line should have 5 entries. The first entry should be a number from set SAMPLES, and then there should be 4 entries corresponding to the data for “rate”, “moist”, “sweet”, and “color”. So you need to add the missing entry in each line.

A more serious problem is that, when you write “sum {v in VARS} coeff[v] * data[i,v]” in your constraint, you are using data[i,v] as a number. But for v equal to “color”, the values given in your data for data[i,v] are character strings like ‘Y’ and ‘R’. You can’t multiply coeff[v] by a character string value. Maybe you can convert the colors to numbers, but since that is a modeling issue that’s part of your homework assignment, I will not try to make any suggestions.

I forgot to add I am getting this error when i run the mod file:

SAHC-hw10.dat, line 12 (offset 241):

expected ; . or number

context: >>> 1 64 4 ‘Y’ <<<

ampl: