I'm working on a homework case using Conjoint analysis and running into an error that reads:
Error in X[k, j] <- x[i, j] : incorrect number of subscripts on matrix
I have tried looking up the error and cannot find anything that is conjoint analysis related. I have compared my data with other datasets (tea, ice) that are preloaded and don't cause the error, and it appears to be the same format, just different data.
library(conjoint)
**load in data**
caModel(y=conjointrating[1,],x=profiles)
This line of code (caModel) works just fine
caUtilities(y=conjointrating[1,],x=profiles,z=levels)
This is where I run in to the error. It seems to come from adding in z=levels
. Other functions from the Conjoint package give the same exact error. The functions that do not require z (levels) as an input do not give an error.
"conjointrating"
gives 40 observations of 16 variables, representing responses to 16 product profiles.
"profiles"
gives 16 observations of 5 variables, representing 16 different product profiles.
"levels"
is 15 observations of 1 variable, a section of which is below:
sm_suite
lg_rm
rm_off
internet
phone
I am receiving the following error:
Error in X[k, j] <- x[i, j] : incorrect number of subscripts on matrix
I expect to get partial utilities in a matrix format with columns representing the different levels.