Questions tagged [multi-level]

529 questions
2
votes
2 answers

Python Pandas Multi-index: keeping same length of level=1 with all level=0 indexes

I have a df_ver1 with multi-index index. I want to drop all rows that have different level[1] length then 2. Here is my dataframe below. In [13]: df_ver1 Out[13]: key nm 0 1 2 3 bar one -0.424972 0.567020 0.276232…
EJ Kang
  • 455
  • 2
  • 5
  • 17
2
votes
2 answers

Reshape/gather function to create dataset ready for multilevel analysis

I have a big dataset, with 240 cases representing 240 patients. They all have undergone neuropsychological tests and filled in questionnaires. Additionally, their significant others (hereafter: proxies) have also filled in questionnaires. Since…
Hannie
  • 417
  • 5
  • 17
2
votes
1 answer

Multilevel meta-analysis using metafor

Does this code look right for a multilevel meta-analysis in R using the metafor package? I have effect sizes ("id") nested within articles ("citation") nested within data sets ("data"). To clarify, multiple effect sizes are often reported within the…
Owen
  • 21
  • 2
2
votes
1 answer

Translating glmer (binomial) into jags to include a correlated random effect (time)

Context: I have a 12 item risk assessment where individuals are given a rating from 0-4 (4 being the highest risk).  The risk assessment can be done multiple times for each individual (max = 19, but most only have less than 5 measurements). The…
Helen
  • 23
  • 4
2
votes
0 answers

Multilevel multinomial logistic regression with mlogit (R)

I´m trying to model a multilevel multinomial logistic regression. I have 42 subjects with 82 observations per person. In each observation the suvjects("VP") were able to react in three different ways mldata <- mlogit.data(data1, choice =…
2
votes
1 answer

Group rows in Pandas DataFrame based on complex condition

I have a basic dataframe, structured like this: Col1 Ind1 Ind2 0 key1 12 key2 35 1 key3 56 key4 24 key5 65 ...and another one like this: ColA 0 key1 1 else 2 else 3 key3 What I need is…
2
votes
2 answers

How to create multi level JSON data using JSONObject in servlet

I need to create JSON data like below, { "min": { "week": "1", "year": "2014" }, "max": { "week": "14", "year": "2017" } } But JSONObject accepts only "id","value" format. So how can I create JSON data using JSONObject like…
Dhanapal
  • 350
  • 2
  • 7
  • 29
2
votes
1 answer

Python: creating separate columns for group labels and individual units when both are in the same column of the original data

I am new to Python and I suspect this question might have been asked before, but I really could not find any relevant threads. Hence, the question. I intend to create a data frame containing separate columns for "group labels" and "individual…
Chris T.
  • 1,699
  • 7
  • 23
  • 45
2
votes
0 answers

How to store a Tree Of Life in MySQL? (Phylum, Class, Order, Family, etc)

(Seems that I cannot recover my previous SE account) I'm currently trying to make a database with the tree of life and I was wondering what would be the best approach to such a thing since it's quite huge and still evolving. The levels (for those…
Jayd
  • 183
  • 3
  • 15
2
votes
1 answer

I have dateframe which is multilevel how do I set date in second level as common index

I currently have a dataframe which is multi level with first level of header being company name and the second level being the date, size and pice for that respective company. I want to set the index as date so in the second level there is no…
2
votes
1 answer

Plotting Moderation Effect in Multilevel Analysis in R

In my dataset I have 3 groups and I would like to plot an interaction between group and x on y. id <- c(1,1,1,2,2,2,3,3,3) group <- c(0,0,0,1,1,1,2,2,2) x <- c(20,50,30,50,65,80,20,50,60) y <- c(120,130,150,200,210,180,160,170,120) I already tried…
M.K.
  • 21
  • 2
2
votes
2 answers

how to use dotplot after clmm

I have tried to plot random effects after clmm, but I got error message: "Error in sort.list(y):'x' must be atomic for `sort.list' Have you called 'sort' an a list?" The following codes are representative of my actual codes.…
Han
  • 55
  • 9
2
votes
1 answer

All fields search

This is my data set, which is part of a bigger json code. I want to write a query, which will match all fields inside the value chain. Dataset: "value_chain" : { "category" : "Source, Make & Deliver", "hpe_level0" : "gift Chain Planning", …
2
votes
1 answer

Pandas applymap on multilevel dataframe

I have a square matrix as a dataframe in pandas. It should be symmetric, and nearly is, except for a few missing values that I filled with 0. I want to use the fact that it should be symmetric to fill the missing values, by taking the max of the…
andbeonetraveler
  • 693
  • 3
  • 11
  • 25
2
votes
2 answers

Python: multi level inheritance

Im having trouble finding an efficient solution to a Python inheritance problem. So there exists some code like the following: class Foo( object ): def __init__(): self.some_vars def foo_func(): x =…
AlENeuman
  • 33
  • 1
  • 4