2

Make two categorical variables, Device with values Sony, LG, ... and Model_Number with values 10, 10.5, 2000, 3200, ... . Then Model_Number is nested within Device. See then How do you deal with "nested" variables in a regression model? for how to model this. But, very shortly, if you are using R then use the nesting operator / in the formula ...


1

There is nothing specifically about one-hot encoding that makes ANOVA inappropriate. Most software (certainly R and SAS) does some version of coding of categorical variables for you. With R and SAS (and maybe others) you can choose among various parameterizations for categorical variables (effect coding, dummy coding, Helmert contrasts etc.)


1

The treatment-contrast default in R, which uses one level of a categorical predictor as reference and describes other levels in comparison against that reference, is not your only choice. This UCLA IDRE web page goes into detail on 9 different ways to set up a design matrix for categorical variables. As you "would like to see the effect of each level of the ...


1

For that many subjects and that range of scores, I'd compare the raw scores, most probably using the paired t-test. Converting to percentiles, if the transformation is linear, would lead to equally valid results, but not that obvious to interpret. Categorizing the scores is, in addition, somewhat arbitrary and involves loss of information. I'd avoid it if ...


1

This was probably more appropriate as a Stack Overflow question but I write the solution for you here. You can achieve what you want by the following codes: Stfmodel1 <- lm(SATISFACTION~AGE+SEVERITY+ANXIETY, data=subset(Stf, SURG=="Yes")) Stfmodel2 <- lm(SATISFACTION~AGE+SEVERITY+ANXIETY, data=subset(Stf, SURG=="No"))


1

Sounds like something you could achieve with topic modelling. Essentially you need to create a matrix where every unique card is a column and every row a deck. Each element of the matrix is either a 1 or 0 depending if that card is in that deck. This is known as a term-document matrix. Once you have this matrix you could then apply latent direchlet ...


1

The default coding of factor variables in R is "treatment contrasts" relative to the first level in the factor definition. There are many other possible contrast arrangements possible. This is not specific to Cox models but applies to all regression methods. Your desire is for a contrast type known in R as "contr.sum". See the UCLA tutorial: https://stats....


1

You could use the categorical variable with its 500 levels as is, but then use regularized logistic regression. In Principled way of collapsing categorical variables with many levels? one idea is to used the fused lasso, but there are other possibilities. I cannot see how the power-law distribution is relevant, and your idea of merging all but the 10 most ...


1

Assuming that by binary encoding you mean the one explained here, I would advice against using it. Seems an ill-advised idea, I will explain why. First explaining shortly the idea: Suppose (only for simplicity) your categorical variable have $p=2^q$ levels, for the example I take $q=3$. Then code the levels with the binary numbers $0=000_2, 1=001_2, 2=...


1

To add a little to @MatthewDrury's answer regarding this question: Say, I have 3 categorical variables, each of which has 4 levels. In dummy encoding, 3*4-3=9 variables are built with one intercept. In one-hot encoding, 3*4=12 variables are built without an intercept. Am I correct? We can examine what the design matrix would look like with and without an ...


Only top voted, non community-wiki answers of a minimum length are eligible