Hi to everybody. I have to do a boxplot with individual observations using the dataset below:
clear
input str3 Litter str6 Strain str3 Strain_old byte Pnd double(Peso Temperatura)
"1B" "B6_2" "B6" 2 . .
"2B" "B6_2" "B6" 2 1.1 27.6
"3B" "B6_2" "B6" 2 1.2 26.8
"4B" "B6_2" "B6" 2 2.6 29.3
"5B" "B6_2" "B6" 2 1.3 30.3
"6B" "B6_2" "B6" 2 1.5 27.7
"7B" "B6_2" "B6" 2 1.3 29.5
"8B" "B6_2" "B6" 2 1.3 28.1
"1B" "B6_4" "B6" 4 1.8 30.5
"2B" "B6_4" "B6" 4 1.6 29.6
"3B" "B6_4" "B6" 4 1.6 30.6
"4B" "B6_4" "B6" 4 1.7 30.4
"5B" "B6_4" "B6" 4 1.9 31.2
"6B" "B6_4" "B6" 4 2.3 32.1
"7B" "B6_4" "B6" 4 2.2 30.8
"8B" "B6_4" "B6" 4 2 31.8
"1B" "B6_6" "B6" 6 2.6 31.4
"2B" "B6_6" "B6" 6 2.2 31.4
"3B" "B6_6" "B6" 6 2.3 31.5
"4B" "B6_6" "B6" 6 2.6 30.2
"5B" "B6_6" "B6" 6 2.6 31.2
"6B" "B6_6" "B6" 6 3.3 32.5
"7B" "B6_6" "B6" 6 3.2 31.7
"8B" "B6_6" "B6" 6 2.9 32.5
"1B" "B6_8" "B6" 8 3.5 33.1
"2B" "B6_8" "B6" 8 2.9 31.7
"3B" "B6_8" "B6" 8 3.2 30.1
"4B" "B6_8" "B6" 8 3.3 32.7
"5B" "B6_8" "B6" 8 3.3 33.3
"6B" "B6_8" "B6" 8 4.5 31.8
"7B" "B6_8" "B6" 8 4.2 32.9
"8B" "B6_8" "B6" 8 4 32.4
"1B" "B6_12" "B6" 12 5.9 33.4
"2B" "B6_12" "B6" 12 5 32.9
"3B" "B6_12" "B6" 12 5.3 30.2
"4B" "B6_12" "B6" 12 4.7 33.5
"5B" "B6_12" "B6" 12 4.4 33.8
"6B" "B6_12" "B6" 12 6.7 34.4
"7B" "B6_12" "B6" 12 6.1 33.8
"8B" "B6_12" "B6" 12 5.9 34.3
"1F" "FVB_2" "FVB" 2 1.8 31.8
"2F" "FVB_2" "FVB" 2 1.6 29.7
"3F" "FVB_2" "FVB" 2 1.6 30.4
"4F" "FVB_2" "FVB" 2 1.8 30.3
"5F" "FVB_2" "FVB" 2 1.8 30.3
"6F" "FVB_2" "FVB" 2 2 29.7
"7F" "FVB_2" "FVB" 2 1.5 30.9
"8F" "FVB_2" "FVB" 2 1.8 30.8
"9F" "FVB_2" "FVB" 2 1.8 30.5
"10F" "FVB_2" "FVB" 2 2.6 31.1
"1F" "FVB_4" "FVB" 4 2.6 31
"2F" "FVB_4" "FVB" 4 2.4 31.5
"3F" "FVB_4" "FVB" 4 2.1 31.3
"4F" "FVB_4" "FVB" 4 2.8 30.9
"5F" "FVB_4" "FVB" 4 2.6 31.1
"6F" "FVB_4" "FVB" 4 2.9 31.7
"7F" "FVB_4" "FVB" 4 2.2 30.8
"8F" "FVB_4" "FVB" 4 2.7 31.6
"9F" "FVB_4" "FVB" 4 2.6 30.8
"10F" "FVB_4" "FVB" 4 3.6 31.3
"1F" "FVB_6" "FVB" 6 3.6 31.7
"2F" "FVB_6" "FVB" 6 3.4 32.1
"3F" "FVB_6" "FVB" 6 2.7 30.8
"4F" "FVB_6" "FVB" 6 3.8 32.5
"5F" "FVB_6" "FVB" 6 3.5 31.4
"6F" "FVB_6" "FVB" 6 4 32.6
"7F" "FVB_6" "FVB" 6 3.1 32.3
"8F" "FVB_6" "FVB" 6 3.5 32.8
"9F" "FVB_6" "FVB" 6 3.6 32.2
"10F" "FVB_6" "FVB" 6 4.6 33.6
"1F" "FVB_8" "FVB" 8 4.3 33.4
"2F" "FVB_8" "FVB" 8 4.5 33.4
"3F" "FVB_8" "FVB" 8 3 30.8
"4F" "FVB_8" "FVB" 8 5 32.2
"5F" "FVB_8" "FVB" 8 4.2 32.1
"6F" "FVB_8" "FVB" 8 4.8 33.1
"7F" "FVB_8" "FVB" 8 4 32
"8F" "FVB_8" "FVB" 8 4.3 32.9
"9F" "FVB_8" "FVB" 8 4.5 33.5
"10F" "FVB_8" "FVB" 8 5.6 33.8
"1F" "FVB_12" "FVB" 12 5.7 33.9
"2F" "FVB_12" "FVB" 12 6.1 34
"3F" "FVB_12" "FVB" 12 3.5 31.5
"4F" "FVB_12" "FVB" 12 6.2 34.1
"5F" "FVB_12" "FVB" 12 6.1 33.4
"6F" "FVB_12" "FVB" 12 6.4 34.6
"7F" "FVB_12" "FVB" 12 5.2 33.7
"8F" "FVB_12" "FVB" 12 5.8 34.3
"9F" "FVB_12" "FVB" 12 6 34.6
"10F" "FVB_12" "FVB" 12 7.1 34.4
"1C" "CD1_2" "CD1" 2 2 30.7
"2C" "CD1_2" "CD1" 2 1.6 30.2
"3C" "CD1_2" "CD1" 2 1.8 30.9
"4C" "CD1_2" "CD1" 2 2 29.3
"5C" "CD1_2" "CD1" 2 1.8 28.7
"6C" "CD1_2" "CD1" 2 2.2 29.9
"7C" "CD1_2" "CD1" 2 2.6 30.2
"8C" "CD1_2" "CD1" 2 1.7 30.2
"9C" "CD1_2" "CD1" 2 2.1 31.1
"10C" "CD1_2" "CD1" 2 2.7 30.7
end
[/CODE]
------------------ copy up to and including the previous line ------------------
I WROTE this code:
sort Strain
by Strain: egen med = median(Peso)
by Strain: egen lqt = pctile(Peso), p(25)
by Strain: egen uqt = pctile(Peso), p(75)
label def Strain 1 "B6_2" 2 "B6_4" 3 "B6_6" 4 "B6_8" 5 "B6_12" 8 "FVB_2" 9 "FVB_4" 10 "FVB_6" 11 "FVB_8" 12 "FVB_12" 15 "CD1_2" 16 "CD1_4" 17 "CD1_6" 18 "CD1_8" 19 "CD1_12"
encode Strain, gen(axis) label(Strain)
local colours grey grey grey grey grey blue blue blue blue blue green green green green green
local Colours grey grey grey grey grey blue blue blue blue blue green green green green green
local values 1 2 3 4 5 8 9 10 11 12 15 16 17 18 19
set scheme s1color
forval j = 1/15 {
local c : word `j' of `colours'
local C : word `j' of `Colours'
local v : word `j' of `values'
local call `call' || rbar lqt med axis if axis == `v', barw(0.6) fcolor(`c') lcolor(`C') ///
|| rbar uqt med axis if axis == `v', barw(0.6) fcolor(`c') lcolor(`C') ///
|| scatter Peso axis if axis == `v', mc(`C') ms(Oh)
}
twoway `call' xla(1 2 3 4 5 8 9 10 11 12 15 16 17 18 19, noticks valuelabel labsize(small)) legend(off) ytitle(Peso) xtitle("") yla(, ang(h)) xli(4 8, lw(vthin) lc(gs12))
I ATTACHED WHAT I'VE GOT (prova17052021.ppt) , but i think that's a misstake
1)How to write more clearly the x-axis legend
1 "B6_2" 2 "B6_4" 3 "B6_6" 4 "B6_8" 5 "B6_12" 8 "FVB_2" 9 "FVB_4" 10 "FVB_6" 11 "FVB_8" 12 "FVB_12" 15 "CD1_2" 16 "CD1_4" 17 "CD1_6" 18 "CD1_8" 19 "CD1_12"?
2) HOW TO ADD THE LINE TO SEPARATE THE THREE GROUPS (B6, FVB, CD1) THANKS TO EVERYBODY
Thanks to everybody
Related Posts with BOX PLOT WITH INDIVIDUAL OBSERVATION--How to write
selection test algorithmDear statalist member, I am trying to conduct a selection bias test for my analysis, but can't seem…
How do I create a cumulative index?Hello, I am trying to perform an operation which in Excel or Python would be very easy. However, I …
massive reshape long terminated by error r(608)Hi Everyone, I was troubled by an error code r(608) when I run a "reshape long" a large size of dat…
How to take fixed effects into account using "bysort i"Hi, I would like to regress an equation using paneldata, but I would like to find estimates for eve…
Testing linearity with a plot of standardized residualsHi forum! I have a question for you. I tried to assess the linearity assumption of my multiple linea…
Subscribe to:
Post Comments (Atom)
0 Response to BOX PLOT WITH INDIVIDUAL OBSERVATION--How to write
Post a Comment