[R] field significance test
Jim Lemon
drj|m|emon @end|ng |rom gm@||@com
Wed Sep 8 01:30:04 CEST 2021
HIi Ani,
I think you are going to a lot of trouble to get a fairly simple result.
# matrix of logicals for positive stat values
possig<-df3 > 0 & df4 < 0.05
# now negative stat values
negsig<-df3 < 0 & df4 < 0.05
# very clunky plots of column counts
barplot(colSums(possig),
names.arg=paste0("S",1:10),
main="Positive significant")
barplot(colSums(negsig))
names.arg=paste0("S",1:10),
main="Negative significant")
You said something about displaying the values of the statistics. As
the positive and negative values are mutually exclusive, you may want
to do something like this:
allsig<-possig | negsig
allsig[!allsig]<-NA
plot(1:10,1:10,type="n",xlab="Station",ylab="Rep",
main="Significant statistical values")
text(rep(1:10,each=10),rep(10:1,10),round(df3*allsig,2))
giving you a matrix-like plot of the stat values. You could also add
the p-values.
Jim
On Tue, Sep 7, 2021 at 10:51 AM ani jaya <gaaauul using gmail.com> wrote:
>
> and yes I can sleep well now. Thank you, Jim.
>
> ne<-rep(0,ne)
> total<-c(neggg,posss,ne)
> hist(total)
>
> Best,
> Ani Jaya
>
> On Tue, Sep 7, 2021 at 9:38 AM ani jaya <gaaauul using gmail.com> wrote:
> >
> > Hello Jim, thank you for your response. What I am trying to achieve is
> > like this:
> >
> > #calculate the positive significant station for every row based on p-value
> > df5<-df3
> > df5[df4>0.05|df5<0]<-NA
> > #remove the insignificant one or negative statistic value
> > df5[df5>0]<-1
> > #change the positive value to be +1 so I can row sum later
> > pos<-as.data.frame(rowSums(df5, na.rm=T)) #row
> > sum to see the total significant station (column) for each row
> > poss<-as.data.frame(table(pos))
> > #get the frequency of each significant number (row that have only
> > 1,2,3,.. significant station)
> > posss<-as.numeric(rep(poss$pos[-1],poss$Freq[-1]))-1 #create
> > the series based on frequency
> >
> > #calculate the negative significant station for every row based on p-value
> > df6<-df3
> > df6[df4>0.05|df5>0]<-NA
> > df6[df6<0]<-1
> > neg<-as.data.frame(rowSums(df6, na.rm=T))
> > negg<-as.data.frame(table(neg))
> > neggg<-(as.numeric(rep(negg$neg[-1],negg$Freq[-1]))-1)*-1
> >
> > ne<-sum(pos==0&neg==0)
> > #to see the 0 significant station, row that have no significant
> > station
> >
> >
> >
> > after that I want to combine posss, neggg, and ne to be 1 column data
> > frame but not success yet. After that, I want to plot the histogram to
> > see the distribution of significant stations.
> > Any lead is appreciate. Thank you
> > Ani Jaya
More information about the R-help
mailing list