Split plot analysis, LSD test and plotting bar graphs using R
HTML-код
- Опубликовано: 10 фев 2025
- In this video, you will learn how to carry out analysis for split-plot design with least significant difference test and plotting bar graphs with standard error bars using R studio.
Video contains:
0:24 - Import data set
1:21 - Converting categorical variables to factor variables
1:51 - Split plot analysis
2:27 - Mean separation test (LSD test)
4:02 - Plotting bar graphs
5:02 - Interaction plot with factor categories
package required: agricolae
=============
Download Links
=============
Updated blog:
Download R-script & data file - visit this blog:
www.agroninfo....
Old blog:
Download R-script & data file - visit this blog:
agroninfotech....
R is free software and you can download it from the link given below
www.r-project....
Download link for R studio
www.rstudio.co...
___________________________________________
====================
Get connected with us on
====================
Website: www.agroninfo....
Facebook page: www.facebook.c...
Twitter: / agroninfotech
Linked In: / agron-info-tech-7429a6156
____________________________________________
If you have any question please comment below.
Thanks for watching this video.
#R #SplitPlot #LSD #LSDTest #SplitPlotAnalysis #BarGraphs #SE #standardError
Thank you so much for the video, easy to follow, 100% recommended.
Thank you
Thanks a lot.
This video was of great help.
hello. Thanks. Is there from you, a video for a 3 ways- anova using r? Please.
Thank you very much!
First of all let me began by thanking you for giving such a wonderful presentation on SPD in r and sir I need some clarity that while comparing interaction treatments means in SPD, usually we will look in two directions know sir, i.e., (1) two sub-plot treatment means at a given main-plot treatment and (2) two main plot treatment means at same or different sub-plot treatment, do we get in that way of interaction comparisons in this package?. Please do respond sir.
Thank you for your compliment. The above two points which you have mentioned specify the main effects for both factors whatever I perceived from your statement. Interaction effect in split plot specify mean values for both main plot and sub plot factor however the difference from factorial experiment is that the factor with less importance is kept in main plot with containing larger experimental error.
@@AGRONInfoTech Thanks for the information sir
You are most welcome
@@AGRONInfoTech
I agree with Mr. devadas.
there are two different LSD value to calculate while we are comparing interaction treatments means in SPD,
(1) comparision. To compare two subplot treatment means for the same whole plot treatment. (e.g. super:4w v.s. super:3w).
(2) comparision. To compare two whole plot means at the same or different sub plot treatments (e.g. shaheen:4w v.s. super:2w) or (e.g. shaheen:2w v.s. super:2w).
please check the webiste for more detail LSD calculation of SPD: www.ndsu.edu/faculty/horsley/splplot.pdf
As your R code in the video, it seems that the result of "out3" conformed to the (1) comparision. that means, the value of LSD (out3)=4.132411 Only can used in comparing subfactor"age" for the same mainfactor "var". It's Not suitable for all means of comparision. We need to calculate another LSD value for the (2) comparision.
My question is, how to calculate the LSD value for the (2) situation??
Very understable. I have a split-split plot design. Could I apply the same test as you did in the video?
Use the following code for ANOVA:
ssp.plot(block, pplot, splot, ssplot, Y)
Arguments
block: replications
pplot: Factor main plot
splot: Factor subplot
ssplot: Factor sub-subplot
Y: Variable, response
@@AGRONInfoTech thank you so much. You're help is invaluable. I'm facing two other problems with my data. First I take mesuarements in 3 different times, so I have the following factors: factor light (4), factor variety (4), factor NaCl treatment (2), replications (4), and with time I have another factor, right?. So I have 4x4x2x4x3 which lead me with 384 observations 😮💨. I was thinking in analyzing each time separately to see what is the factor that influences the most, then eliminate that factor and evaluate within my 3 different times. What do you think of this approach? Also, I'm worried because I might and unbalanced design since some plants in my experiment die earlier. How does that influences in the analysis? (Sorry to bother you with all theses questions)
thank you for this session. can i add error bar in interaction bar graph? please reply
Go through the video on plotting bar graphs with SE. The link is given below:
ruclips.net/video/onDRLhJ_toI/видео.html
Thanks for your video
to perform this analysis, do we need to chech the normallity of the distribution and the homogeneity of variance
You can check the normality of the data before proceeding for this analysis. However for homogeneity of variances it depends what type of data you are working on. For example if you have a dataset that was repeated over years, location, sites or harvests then you need to first look at the homogeneity of variances across the repeating factor. I hope this make sense.
@@AGRONInfoTech Thanks
You are most welcome
Thanks alot
Please guide me how to do augmented split plot design analysis.
I have to work on augmented factorial and split anlysis. I shall keep augmented split plot analysis in loop. Shall upload video on this aspect later on. Thanks for the suggestion.
thanks for the video...
i just would like to know that what is the meaning of GLA and GLA, EA and Eb, and what is the function?
Thanks for your helpful tutorial. Could you tell how to run LSD test for multi-variables data set? If I run LSD test one by one, tit will takes long time due to there are only four groups but 15 variables.
I am just making another video on it where you will get publication ready style mean comparison test for the given data set within few simple steps.
@@AGRONInfoTech Thank you so much. I am looking for it soon
Thanks for your support
great work
Thank you
Thank you very much and it was great Experience, and I would like to know which CV value to use in split plot, the main plot factor, the sub plot factor or the interaction?, because it lists like CVa,and CVb ,I would like to thank you and wish to follow your other posts.
There are actually two CVs, one for the sub plot CV (b) and one for whole plots CV (a). Presentation of the former is usually sufficient. However you can also use the whole plot CV. CV for whole plots is usually lower than CV for sub plot because larger plot tend to have lower CV. Sub plot CV also reflects variation for interaction term.
dear professor can you use the methode for split plot for putting the letter a, b, c
Thank you. I shall create video on it later on however, if you need it urgently then you can send me data and the Rscript you have at the below email address. I shall amend it and will share it with you.
agron.infotech@gmail.com
OMG! thank you so much! its works perfectly and I understand clearly on this method!
i have a question, what is the code for add the average number of each bar? I want to put each X bar of average on top of each error line.. thank you
Thanks. You can use text(data, model$average, cex=1) to add average values above the bars.
Here model may be the output of aov() function and after dollar sign type the component representing average values.
thanks for amazing video. can you provide the commands that u have used in video?
Thanks. You can get the commands from the following link of blog...
agroninfotech.blogspot.com/2018/06/split-plot-analysis-using-r.html
Thank you for nice presentation to learn the SPD analysis. Can you please share the R Codes for this analysis. Please let me know the R and R Studio difference. Can we done the Split Plot Design Analysis in both of this. Thanks.
Dear Dr. Baviskar the link for R script or commands to perform split plot analysis is added in description of this video. Please download it.
However for the difference in R and R studio, I shall simply say as the difference between window 98 and XP. You need to install R and then R studio.
@@AGRONInfoTech Thank you for the information. Will be performing analysis with these codes, hope it will work on my desktop.
I hope this will work. If you get some error then let me know
Very good demonstration. For the interaction plot, how do i sort them? For example, I want them in the order of Shaheen:2W, Super:2W, Shaheen:3W, Super:3W, Shaheen:4W, Super:4W.
Just reverse interaction term at 5:15 to var:age instead of age:var. Also use this interaction term ahead if needed.
Hello. I have tried testing with duncan.test for the interaction analysis but it didn't work. For my data, I typed as: duncan.test (data, response, main-factor:sub-factor, Edf_b, EMS_b, alpha=0.05, group=TRUE, console=TRUE), it returned an error as: Error in names(DUNCAN)
Before analysis of variance you need to convert factor variables from character to factor by using below command:
data$main-factor = as.factor(data$main-factor)
data$sub-factor = as.factor(data$sub-factor)
Then run ANOVA followed by duncan.test
Hope this will fix the issue. If still have an error share me your data at agron.infotech@gmail.com
Thank you for your reply. I followed what you has suggested but it showed the same error. It only work with LSD.test. I will send the data to your email. Thank you.
The issue was resolved by using attach(data) function after conversion of variables (character) to factor variables.
thanks for the video...
i just would like to know what software is used in analysing.???
R software is used. Its free software and can be downloaded from the link given in description of this video.
Thanks, but please use a voice with microphone to make it easy for us to understand and provide data as well to practice
Thanks for the suggestion. I shall also share the link in the description of the videos to download the data for practice.
thanks!
You are welcome
Thank you sir, Can you also upload videos on how to analyze factorial rcbd design.
Thank you
Thanks for your feed back. I shall also include 3 and 4 factor factorial analysis soon. However you can go through 2 factor factorial analysis under rcbd and crd in videos.
ruclips.net/video/ATAwYOM4liM/видео.html
Sir..what package should I install to use the model command?
Install "agricolae" package by using following command:
install.packages(agricolae)
Also visit blog post on split plot analysis. The link is given in the description of the video.
Thanks
You are welcome
Sir..by loading agricolae
.I didn't get the model command..its showing an error..
This is the model I would like to develop in R. I am trying to use the Location:Treatment interaction df and MSE in the LSD separation test but don't know how to do. Your R code showed the error message from my previous questions.Combined RCBD (treatments fixed, locations random).
SOV Df Expected Mean Square F-test
Location l-1 Non-valid
Rep(Loc) l(r-1) Non-valid
Treatment t-1 1222−++ΣtrlrLTτσσ T MS/Loc*Trt MS
Location*Treatment (l-1)(t-1) 22LTrσσ+ Loc*Trt MS/Error MS
Error l(r-1)(t-1) 2σ
Total lrt-1
Can you send me data containing at least one variable with treatment, location and replications levels at agron.infotech@gmail.com
I shall run the same model and see what actual problem you are facing and how to fix it.
The interaction effect was not significant, yet you perform a post hoc test, why? Second question: What does it mean when Ea and Eb have p
When main or interaction effect is non significant then there is no need to go for mean comparison test however I have just performed it to show the way in case if you have significant interaction.
Ea and Eb are the error terms they don't have probability values. Only rep, factor A, factor B and interaction contain p value.
@@AGRONInfoTech Thanks for your quick reply!
You are most welcome
thank you for your video, but i still confused, some script is error symbol in Rstudio, start from "install.packages("agricolae" dependecies = TRUE)" and "sp.plot", please help if you have new script, thank you
Can you share what error you get while installing package sp.plot? Or send screen shot at agron.infotech@gmail.com
Dear sir, please help me to analysis three factorial data, what will be model, model
Do you want three factor factorial analysis or three factor with split split plot arrangement?
For three factor factorial use below command
results
@@AGRONInfoTech I want to analysis three factorial split split design
Use below command for split split plot analysis
ssp.plot(block, pplot, splot, ssplot, Y)
Where
block = replictions
pplot = Main plot factor
splot = Sub plot factor
ssplot = sub-subplot factor
Y = response variable (e.g yield)
You need to load library agricolae before using this command
require(agricolae)
Also use attach function before using ssp.plot function
attach(datafilename)
@@AGRONInfoTech Thanks for your collaboration
Response: Yield
Df Sum Sq Mean Sq F value Pr(>F)
Site 5 61735 12347.1 445.2227
In video tutorial follow instructions at 3:22 glb and Eb commands are used to represent Error df and Error MS for the interaction term. And then use out1 command to get LSD test. If you still did not get point let me know.
thanks for this video.
I have a problem.
when I run this circle :
out3
Can you copy and send me complete commands that you used during analysis in R at agron.infotech@gmail.com
I shall probably lookover what actual issue you are facing and also the data you have used for at least one response variable or yield.
model
Load package agricolae:
library(agricolae)
agricolae package is not working on later Rstudio versions. How can I fix this?
Can you show the error message? Which version of R you are using? On my side there is no issue with agricolae package.
@@AGRONInfoTech RStudio Desktop 2022.02.0+443. Prairie Trillium Release. Here is the error code - > library(agricolae)
Error: package or namespace load failed for ‘agricolae’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘klaR’
In addition: Warning messages:
1: package ‘lmerTest’ was built under R version 3.6.2
2: package ‘lme4’ was built under R version 3.6.2
3: package ‘agricolae’ was built under R version 3.6.2
Have you successfully installed agricolae package keeping dependencies as TRUE?
Try using below command in console to reinstall this package.
install.packages("agricolae", dependencies = T)
@@AGRONInfoTech Thank you very much for your suggestion. I tried the command but still not working. Error: package or namespace load failed for ‘agricolae’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘klaR’
In addition: Warning message:
package ‘agricolae’ was built under R version 3.6.2
@@danielaboagye8538 Also try install R version 3.6.2
How do i rearrange the x-axis? I found that if it is 25:a, 50:a, 100:a, it starts with 100:a, then 25:a, 50:a.
You may reverse the sequence. Let me know what sequence you used?
@@AGRONInfoTech Thanks for your response. I have created a dummy csv file (drive.google.com/file/d/1aQuOODDLtkUI5K97f-HvXutxfX79v38Z/view?usp=sharing). Let's say the sequence I need is 20:a, 20:b:40:a,60:a,80:a,100:a,40:b,60:b,80:b,100:b.
Thank you for the video sir, it helps me lot
I have an issue while performing mean separation of interaction. Please help me..
#Error in names(DUNCAN)
May be you have not attached the components of the data file. Using below command may fix the it.
attach(data)
If still have some issues please let me know
@@AGRONInfoTech View(SPP)
attach(SPP)
rep=as.factor(Rep)
Mainplot=as.factor(Mip)
subplot=as.factor(Sup)
model
Send me output of the command str(SPP) at agron.infotech@gmail.com
Hi, I have two years of collected data from split-plot experiments. I am a new user of R, So, I am looking for help from anyone to combine the analysis of my experiment with full mainplot error and subplot error. Thank you!
Hi you can share the data at agron.infotech@gmail.com and I shall send you the analysis with Rscript.
Thank you for the Wonderful video!!
I have some question, accordind to the website: www.ndsu.edu/faculty/horsley/splplot.pdf
there are two different LSD value to calculate while we are comparing interaction treatments means in SPD,
(1) comparision: To compare two subplot treatment means for the same whole plot treatment. (e.g. super:4w v.s. super:3w).
(2) comparision: To compare two whole plot means at the same or different sub plot treatments (e.g. shaheen:4w v.s. super:2w) or (e.g. shaheen:2w v.s. super:2w).
In this video, the result of "out3" conformed to the (1) comparision, that means, the value of LSD (out3)=4.132411 Only can used in comparing sub-factor"age" for the same main-factor "var". IT's Not Suitable for all interaction treatments means of comparision. We need to calculate another LSD value for the (2) comparision.
Please let me know if i am wrong, and how to calculate the LSD value for the (2) situation??
Looking for your reply, thank you very much!!
hello. I am trying, but I m still having the ANOVA table with "'Nan'" for block, Ea, and Eb in F value and Pr columns. Then, when I continued with the LSD test, I m still getting this message '"Error in qt(1 - alpha/2, DFerror) :Non-numeric argument to mathematical function". How can I solve the issue, please.
Upon realizing, I noticed that the dataset you shared with me appears to be empty. Please make use of the appropriate data file.