# Tag Info

0

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

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=... 0 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 ... 0 As a special case, you can try using fbprophet to predict the sales including the variable as a regressor in the model. 1. It captures the trend. 2. Captures the seasonality. 3. You can use add_regressor method to accomodate variable c in your case as a special event.However, not sure how other two variables will fit in the model.You can explore more or ... 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 ... 3 This seems to be a design with repeated measures within subjects. This means that measurements within a particular subject are likely to be more similar to each other than to other subjects. That is, there will be correlation within subjects. One way to proceed with this is to use a mixed effects model and fit random intercepts for subject. In the common ... 2 An ANCOVA model would be one way. It would look something like ElephantDensity ~ Control * PlantDensity This will fit fixed effects for Control and PlantDensity, along with an interaction term between them. The interaction will quantify the extent to which the association between PlantDensityand ElephantDensity varies at the different levels of treatment. ... 0 I am currently working with a high imbalanced dataset and what I do is the following: Stratified k-folds for training / gridsearch If you are using sklearn's gridsearch, there is a parameter called 'refit' where you can specify you want to maximize a certain metric (say precision in your case) Use an ensemble of classifiers (an extreme example: https://www.... 0 My solution import numpy as np def layer_1_z(x, w1, b1): return 1 / w1 * x + b1 def layer_2(x, w1, b1, w2, b2): y1 = layer_1_z(x, w1, b1) y2 = y1 - np.floor(y1) return w2 * y2 + b2 def layer_2_activation(x, w1, b1, w2, b2): y2 = layer_2(x, w1, b1, w2, b2) # return 1 / (1 + np.exp(-y2)) return (y2 > 0) * 1 def loss(param): ... 0 It depends on how you build your prediction model. For example, suppose you have a model that says: for region A the score is 1 and for all other regions the score is zero. Then your model will correctly predict the score for the first two people and incorrectly for the others. Or you can have a model that predicts for region A a score of 0.95, for region B ... 0 In the case of countries I would recommend using predefined groups( at least in the beginning). geographic groups(continent, region etc.) economic groups(currency, trade, income etc.) cultural/political groups(religion, state, war etc.) I would prefer a solution using this kind of variables because interpreting results will be a lot easier if results are ... 1 OP describes categorical data and should use approaches from that domain. I highly recommend the netCoin package in R. https://cran.r-project.org/web/packages/netCoin/vignettes/netCoin.html It will check for coincidences using Haberman. By coincidences and co-occurrence here mean two features occurring on the same objects far more than chance. Haberman ... 3 Since you say : the effect of snpA as the idea is that the AA patients are protected, AB are at low risk and BB are at high risk. this implies that you should fit snpA as a fixed effect, not random. Besides, since it has only 3 levels and the levels you have are the total population of such levels for that genotype, it would not make much sense to ... 1 The chi-square ignores the ordering in your categories. It will respond to any kind of association between the variables. The Spearman takes account of the ordering but is responsive to a tendency for monotonic association (when both variables tend to be larger together and smaller together, or when both variables tend to move in opposite directions) [The ... 0 Typically when summarizing an distribution with a single number there is loss of information, after all you cannot recover the distribution from just that single number. The question is not if there is loss of information but whether the summary is sensible. The uncertainty coefficient (Theil's U) is a conditional measure: given one variable how well can ... 0 You could try out the pingouin package: https://pingouin-stats.org/index.html It seems to cover mixed anovas, which are not yet fully implemented in statsmodels. 0 For this problem I recommend using latent class clustering. This kind of clustering algorithm is appropriate for categorical responses. Your assessment that methods such as k-means clustering are probably not a good choice is correct. Latent class clustering is a model-driven clustering algorithm. It assumes that we observe a mixture of a finite number of "... 0 You can do two data pre-processing transformations: mapping non-numeric data into binary dummies is a method. Check this article'sdata section. Your data is basically similar. After data pre-processing , SVM or another data classifier methods can be applied. 3 You can see from your diagnostic plots that you have two separate groups, which presumably correspond to the response variables unique_locality and unique_time. This occurs because you have fit a logistic regression using a binary response outcome, rather than using a multiple logistic regression that can handle the three-category outcome you actually have. ... 1 Remember that factor analysis in general is rotationally indeterminate, and more broadly is at risk of having more free parameters than can be estimated. Constraints are necessary to achieve some degree of identifiability. Different sets of constraints may achieve solutions that equivalent except for rotation--but one rotation(which fa may provide) may lack ... 0 For simplicity, assume that there is one focal continuous predictor$x$and a continous outcome$y$. Standardization doesn't really make a lot of sense with categorical predictors, imo. The regression model could include more predictors but the following answer focuses only on one of them. Then, we have four possibilities: Both$y$and$x\$ are standardized (...

0

You can use the Mann-Whitney U test to compare the mean rank of female answers with the mean rank of males answers.

-1

Your counts per cell are too low. The general rule of thumb is, if the count is bellow 5, use fisher.test. > fisher.test(a) The Fisher exact test extends well to small and large counts, while the chisq.test is generally used for larger counts. You have several values that are 0 and all are below 5, so the Fisher test is what you need!

Top 50 recent answers are included