Bayesian Hierarchal Model_ not all parameters converging based on Rhat and effective sample size values values

Hello all, I am running a BHM designed to estimate metabolism in streams. The model runs fine and converges with no errors. However, when I plot the parameters Rhat to see which days didn’t converge, I have 3 parameters that are doing well ( Pmax, alpha, and GPP, and two parameters that are not ( K600 and ER). I am not sure what changes do I need to make to make sure it all converges, and whether this is an acceptable estimation for the individual parameters based on the data or not. I am using 4 chains and 4000 steps divided between burning and saved steps.
I am following the convention of R^<1.1 and Neff/N <0.05 as not converged. But unsure what would be a realistic number. This is based on the mcmc diagnostic post. I would appreciate your suggestions and inputs on this.


My code is below the data , note that you need to install the StreamMetabolizer package as it has the stan models in it.
Sample data

	solar.time	DO.obs	DO.sat	depth	temp.water	light

4	12/10/2019 2:00	6.655733333	6.976690936	1	24.058	0
5	12/10/2019 3:00	6.562333333	6.983595513	1	24.11216667	0
6	12/10/2019 4:00	6.492533333	6.988034175	1	24.04183333	0.51835048
7	12/10/2019 5:00	6.437266667	6.992397346	1	23.99566667	16.82282922
8	12/10/2019 6:00	6.443466667	6.995071627	1	23.97216667	109.0053905
9	12/10/2019 7:00	6.4912	6.988502092	1	23.99616667	230.0909752
10	12/10/2019 8:00	6.5638	6.972060403	1	24.16016667	360.53043
11	12/10/2019 9:00	6.673466667	6.94862973	1	24.415	494.3776766
12	12/10/2019 10:00	6.769	6.912858625	1	24.66566667	601.2851976
13	12/10/2019 11:00	6.866333333	6.865479211	1	24.888	645.2566332
14	12/10/2019 12:00	7.001333333	6.84333908	1	25.53516667	653.9240514
15	12/10/2019 13:00	7.068133333	6.833110521	1	25.66366667	632.4809251
16	12/10/2019 14:00	6.943933333	6.839342204	1	24.9295	571.4659988
17	12/10/2019 15:00	6.82	6.868569657	1	24.76566667	474.6563439
18	12/10/2019 16:00	6.685133333	6.88236363	1	24.50416667	345.7230054
19	12/10/2019 17:00	6.595866667	6.887202158	1	24.50866667	192.5300489
20	12/10/2019 18:00	6.6732	6.889449107	1	24.65116667	54.26776106
21	12/10/2019 19:00	6.730933333	6.89152532	1	24.63166667	5.228815158
22	12/10/2019 20:00	6.7512	6.897608899	1	24.53366667	0.154055213
23	12/10/2019 21:00	6.720533333	6.907470176	1	24.44866667	0
24	12/10/2019 22:00	6.691066667	6.918683057	1	24.40666667	0
25	12/10/2019 23:00	6.648133333	6.930646595	1	24.3315	0
26	12/11/2019 0:00	6.542333333	6.943531903	1	24.24	0
27	12/11/2019 1:00	6.451733333	6.95355893	1	24.08233333	0
28	12/11/2019 2:00	6.366266667	6.961747224	1	24.1015	0
29	12/11/2019 3:00	6.2746	6.969466777	1	24.1205	0
30	12/11/2019 4:00	6.2352	6.974270675	1	24.06466667	0.851834705
31	12/11/2019 5:00	6.189333333	6.981318726	1	23.97833333	25.36700317
32	12/11/2019 6:00	6.144133333	6.986442004	1	23.929	118.3198405
33	12/11/2019 7:00	6.168533333	6.980936736	1	23.8925	253.1099957
34	12/11/2019 8:00	6.279933333	6.963584794	1	23.9915	390.6853785
35	12/11/2019 9:00	6.415133333	6.937932883	1	24.32233333	508.5933479
36	12/11/2019 10:00	6.598733333	6.90313412	1	24.63616667	596.4256619
37	12/11/2019 11:00	6.766666667	6.866664162	1	24.847	642.1850442
38	12/11/2019 12:00	6.8704	6.836731768	1	25.34766667	654.3803266
39	12/11/2019 13:00	7.059866667	6.801916304	1	25.44533333	637.7817837
40	12/11/2019 14:00	7.280933333	6.772938753	1	25.77416667	580.3341418
41	12/11/2019 15:00	7.4122	6.759026898	1	26.131	483.6173731
42	12/11/2019 16:00	7.536	6.75223179	1	26.04983333	356.9074138
43	12/11/2019 17:00	7.550066667	6.762705098	1	25.8285	214.9473478
44	12/11/2019 18:00	7.464533333	6.782658953	1	25.658	84.29810614
45	12/11/2019 19:00	7.3618	6.804711469	1	25.52566667	14.44947274
46	12/11/2019 20:00	7.227333333	6.827657684	1	25.3805	0.208427641
47	12/11/2019 21:00	7.1554	6.840908346	1	25.07466667	0
48	12/11/2019 22:00	7.112333333	6.853734007	1	25.0535	0
49	12/11/2019 23:00	7.059133333	6.86416114	1	25.1805	0
50	12/12/2019 0:00	7.052866667	6.869050804	1	24.94716667	0
51	12/12/2019 1:00	7.0544	6.879524341	1	24.89816667	0
52	12/12/2019 2:00	7.028933333	6.891851552	1	24.85366667	0
53	12/12/2019 3:00	6.9578	6.90434649	1	24.74633333	0.000453104
54	12/12/2019 4:00	6.8916	6.915867159	1	24.65666667	0.890348508
55	12/12/2019 5:00	6.771533333	6.925721964	1	24.52983333	26.10103095
56	12/12/2019 6:00	6.6448	6.934248621	1	24.60133333	119.8753451
57	12/12/2019 7:00	6.6236	6.934612651	1	24.4965	254.6102216
58	12/12/2019 8:00	6.674133333	6.928185677	1	24.46933333	392.7420156
59	12/12/2019 9:00	6.741933333	6.915472085	1	24.633	512.6178138
60	12/12/2019 10:00	6.851266667	6.887821264	1	24.83016667	595.4270216
61	12/12/2019 11:00	6.986666667	6.847113966	1	25.105	638.7002246
62	12/12/2019 12:00	7.109466667	6.804197392	1	25.59883333	651.0105954
63	12/12/2019 13:00	7.2276	6.764207033	1	26.00683333	629.6635271
64	12/12/2019 14:00	7.311466667	6.739516329	1	26.182	564.4805011
65	12/12/2019 15:00	7.2932	6.744727592	1	26.176	470.1339172
66	12/12/2019 16:00	7.2584	6.761423587	1	25.79633333	347.6088224
67	12/12/2019 17:00	7.199933333	6.78269958	1	25.23616667	192.8526586
68	12/12/2019 18:00	7.137866667	6.800226779	1	25.3265	73.98410965
69	12/12/2019 19:00	7.0986	6.804485501	1	25.21233333	13.58631044
70	12/12/2019 20:00	7.051733333	6.804561992	1	25.36966667	0.24014489
71	12/12/2019 21:00	6.9936	6.807477687	1	25.30433333	0
72	12/12/2019 22:00	6.921	6.814725263	1	25.2435	0.000453104
73	12/12/2019 23:00	6.8494	6.826930426	1	25.11566667	0.014499314
74	12/13/2019 0:00	6.8352	6.84104213	1	24.945	0.08382416
75	12/13/2019 1:00	6.8246	6.855039229	1	24.75233333	0.03171725
76	12/13/2019 2:00	6.8062	6.866954378	1	24.6005	0
77	12/13/2019 3:00	6.749066667	6.880585134	1	24.56383333	0
78	12/13/2019 4:00	6.6518	6.886595681	1	24.44	0.840507116
79	12/13/2019 5:00	6.558866667	6.888182176	1	24.267	25.04756516
80	12/13/2019 6:00	6.5318	6.886648647	1	24.54816667	117.2940141
81	12/13/2019 7:00	6.572466667	6.876539405	1	24.5725	252.6786411
82	12/13/2019 8:00	6.639	6.862793381	1	24.642	393.2195868
83	12/13/2019 9:00	6.6946	6.843578183	1	24.75533333	518.6472629
84	12/13/2019 10:00	6.739533333	6.809961233	1	25.04316667	607.4455937
85	12/13/2019 11:00	6.794933333	6.771278078	1	25.44283333	652.5158055
86	12/13/2019 12:00	6.875066667	6.73253818	1	25.88433333	662.3526839
87	12/13/2019 13:00	6.984133333	6.713714872	1	26.172	643.3644727
88	12/13/2019 14:00	7.100666667	6.715578279	1	26.01833333	584.3880594
89	12/13/2019 15:00	7.202733333	6.725715598	1	25.55483333	488.4501758
90	12/13/2019 16:00	7.239466667	6.744881443	1	25.438	363.2336458
91	12/13/2019 17:00	7.2002	6.75846441	1	25.4355	223.6559984
92	12/13/2019 18:00	7.103933333	6.767782158	1	25.321	91.05977066
93	12/13/2019 19:00	6.9964	6.77865411	1	25.21233333	16.11462834
94	12/13/2019 20:00	6.922866667	6.786462808	1	25.14516667	0.222020748
95	12/13/2019 21:00	6.9154	6.787171967	1	25.1255	0
96	12/13/2019 22:00	6.909866667	6.789037602	1	25.224	0
97	12/13/2019 23:00	6.892933333	6.791883405	1	25.16666667	0
98	12/14/2019 0:00	6.847066667	6.7988293	1	24.97433333	0
99	12/14/2019 1:00	6.772666667	6.811254411	1	24.87083333	0
100	12/14/2019 2:00	6.713	6.821255871	1	24.69483333	0
101	12/14/2019 3:00	6.671933333	6.829900483	1	24.66516667	0.001812414
102	12/14/2019 4:00	6.6642	6.833778578	1	24.56133333	0.927956104
103	12/14/2019 5:00	6.699866667	6.826438883	1	24.545	26.07656336
104	12/14/2019 6:00	6.750266667	6.813221288	1	24.83483333	116.5418621
105	12/14/2019 7:00	6.786733333	6.789284697	1	25.04383333	249.3492361
106	12/14/2019 8:00	6.794	6.75511343	1	25.26516667	387.1951217
107	12/14/2019 9:00	6.7712	6.718793939	1	25.54716667	508.6835155
108	12/14/2019 10:00	6.7578	6.687478513	1	26.0495	598.0609126
109	12/14/2019 11:00	6.781533333	6.665918921	1	26.22066667	638.7405508
110	12/14/2019 12:00	6.862066667	6.659343345	1	26.18383333	654.5624743
111	12/14/2019 13:00	6.933	6.664954917	1	26.02266667	631.9272325
112	12/14/2019 14:00	6.992333333	6.669483365	1	25.78933333	570.1592481
113	12/14/2019 15:00	7.0132	6.675241301	1	25.78283333	481.4592408
114	12/14/2019 16:00	7.015066667	6.675232691	1	25.73833333	359.0043771
115	12/14/2019 17:00	7.003933333	6.676907093	1	25.73233333	218.1281349
116	12/14/2019 18:00	6.983666667	6.681776888	1	25.68683333	87.80376843
117	12/14/2019 19:00	6.972133333	6.684438949	1	25.6455	15.26505916
118	12/14/2019 20:00	6.9348	6.689926882	1	25.62583333	0.126868999
119	12/14/2019 21:00	6.8738	6.695463839	1	25.637	0
120	12/14/2019 22:00	6.807733333	6.701460386	1	25.5185	0
121	12/14/2019 23:00	6.728	6.708831579	1	25.4165	0.000453104
122	12/15/2019 0:00	6.6376	6.713354219	1	25.36433333	0.011327589
123	12/15/2019 1:00	6.577533333	6.712890923	1	25.26466667	0.004531036
124	12/15/2019 2:00	6.512466667	6.7124065	1	25.4015	0
125	12/15/2019 3:00	6.464133333	6.709933903	1	25.30466667	0.000906207
126	12/15/2019 4:00	6.440266667	6.707993161	1	25.26866667	0.754870542
127	12/15/2019 5:00	6.451933333	6.706650898	1	25.28866667	22.02445816
128	12/15/2019 6:00	6.508333333	6.695885072	1	25.307	107.5758488
129	12/15/2019 7:00	6.587266667	6.680825207	1	25.60933333	235.9772437
130	12/15/2019 8:00	6.6696	6.65834817	1	25.81116667	371.9531709
131	12/15/2019 9:00	6.741466667	6.632475988	1	26.036	494.9472278
132	12/15/2019 10:00	6.802333333	6.616388921	1	26.31016667	581.4157
133	12/15/2019 11:00	6.872866667	6.600198303	1	26.34633333	630.5334859
134	12/15/2019 12:00	6.922933333	6.585644106	1	26.20933333	647.8361518
135	12/15/2019 13:00	6.939266667	6.582186542	1	26.50683333	631.9652932
136	12/15/2019 14:00	6.9002	6.578968315	1	26.65283333	574.7890604
137	12/15/2019 15:00	6.868266667	6.574499924	1	26.19416667	473.8616002
138	12/15/2019 16:00	6.8604	6.57583771	1	26.292	345.1493763
139	12/15/2019 17:00	6.8604	6.577350951	1	26.53516667	199.1131906
140	12/15/2019 18:00	6.876133333	6.575804822	1	26.41883333	74.12457176
141	12/15/2019 19:00	6.876733333	6.578377717	1	26.40016667	12.60987226
142	12/15/2019 20:00	6.837266667	6.584863685	1	26.37966667	0.308110425
143	12/15/2019 21:00	6.803533333	6.590561423	1	26.38616667	0
144	12/15/2019 22:00	6.735	6.597742565	1	26.342	0
145	12/15/2019 23:00	6.627866667	6.607310271	1	26.235	0
146	12/16/2019 0:00	6.487866667	6.618529915	1	26.1085	0
147	12/16/2019 1:00	6.3554	6.629848578	1	25.95733333	0
148	12/16/2019 2:00	6.251133333	6.641642103	1	25.80616667	0
149	12/16/2019 3:00	6.196066667	6.651515641	1	25.73016667	0.000453104
150	12/16/2019 4:00	6.1728	6.657394508	1	25.629	0.729949846
151	12/16/2019 5:00	6.1538	6.660707399	1	25.68933333	21.64521048
152	12/16/2019 6:00	6.149733333	6.655886692	1	25.7475	106.6438147
153	12/16/2019 7:00	6.166866667	6.630897122	1	25.82433333	237.6813662
154	12/16/2019 8:00	6.189866667	6.592497831	1	26.22	376.5172831
155	12/16/2019 9:00	6.263533333	6.553041981	1	27.08833333	497.8756361
156	12/16/2019 10:00	6.374466667	6.5231035	1	27.40383333	583.7287937
157	12/16/2019 11:00	6.4848	6.514413152	1	27.18066667	617.9485344
158	12/16/2019 12:00	6.6136	6.526676479	1	27.01133333	630.2901693
159	12/16/2019 13:00	6.696066667	6.54658944	1	26.78966667	617.3173611
160	12/16/2019 14:00	6.687733333	6.562516947	1	26.59283333	564.7247239
161	12/16/2019 15:00	6.653866667	6.574601807	1	26.4505	472.5988006
162	12/16/2019 16:00	6.5532	6.588082522	1	26.461	348.1081426
163	12/16/2019 17:00	6.433466667	6.602465872	1	26.39216667	214.8277285
164	12/16/2019 18:00	6.428466667	6.61409955	1	26.144	85.69275892
165	12/16/2019 19:00	6.428933333	6.625385647	1	26.085	14.66922797
166	12/16/2019 20:00	6.4754	6.631189523	1	26.17983333	0.222020748
167	12/16/2019 21:00	6.5448	6.631615083	1	26.21433333	0
168	12/16/2019 22:00	6.547066667	6.63316516	1	26.23183333	0
169	12/16/2019 23:00	6.527533333	6.635938818	1	26.17633333	0
170	12/17/2019 0:00	6.499333333	6.640191141	1	26.113	0
171	12/17/2019 1:00	6.431066667	6.646905986	1	26.08133333	0
172	12/17/2019 2:00	6.334666667	6.655913008	1	26.019	0
173	12/17/2019 3:00	6.219733333	6.666261918	1	25.87666667	0.003624829
174	12/17/2019 4:00	6.072066667	6.676497755	1	25.75916667	0.555958076
175	12/17/2019 5:00	6.037133333	6.676598284	1	25.722	14.97643218
176	12/17/2019 6:00	6.116733333	6.66027446	1	25.806	94.86991855
177	12/17/2019 7:00	6.195866667	6.631516354	1	26.28666667	233.0764746
178	12/17/2019 8:00	6.361666667	6.595683342	1	26.739	372.9259842
179	12/17/2019 9:00	6.508333333	6.569484454	1	27.01366667	494.9490402
180	12/17/2019 10:00	6.489466667	6.567230657	1	27.18983333	585.1977555
181	12/17/2019 11:00	6.461666667	6.575872502	1	26.709	630.3662907
182	12/17/2019 12:00	6.446533333	6.589070377	1	26.41466667	616.3875926
183	12/17/2019 13:00	6.444066667	6.597192932	1	26.48633333	589.063182
184	12/17/2019 14:00	6.5234	6.586262504	1	26.626	486.8398457
185	12/17/2019 15:00	6.652666667	6.570372601	1	26.62983333	445.8357853
186	12/17/2019 16:00	6.755066667	6.558340404	1	27.02083333	333.0361055
187	12/17/2019 17:00	6.773933333	6.552237098	1	26.97033333	192.5739999
188	12/17/2019 18:00	6.750533333	6.552780706	1	26.92633333	98.16715321
189	12/17/2019 19:00	6.702466667	6.558489849	1	26.88133333	23.15812329
190	12/17/2019 20:00	6.676666667	6.562883456	1	26.886	0.54372428
191	12/17/2019 21:00	6.687666667	6.565920926	1	26.88566667	0
192	12/17/2019 22:00	6.665733333	6.567346814	1	26.86216667	0
193	12/17/2019 23:00	6.592466667	6.570598057	1	26.864	0
194	12/18/2019 0:00	6.495666667	6.576159168	1	26.83916667	0
195	12/18/2019 1:00	6.363333333	6.584765074	1	26.71166667	0
196	12/18/2019 2:00	6.263466667	6.595698889	1	26.5315	0
197	12/18/2019 3:00	6.230733333	6.607048892	1	26.4005	0

stan model // b_Kn_oipi_tr_psrckm.stan which is attached b_Kn_oipi_tr_psrckm.stan (4.7 KB)

**Code to run the model** 

 dat<-data.frame(solar.time=as.POSIXct(Site$solar.time,tz="UTC",format="%Y-%m-%d %H:%M:%OS"),DO.obs=ma(Site$DO.obs,30),DO.sat=Site$DO.sat,depth=1,temp.water=Site$temp.water,light=Site$light)
sc6nm <- mm_name('bayes',GPP_fun='satlight',ER_fun='constant',pool_K600 ="normal", err_proc_acor = FALSE, err_proc_iid = TRUE)
sp6 <- specs(sc6nm,alpha_meanlog=.2,alpha_sdlog=.2,Pmax_mu=3,Pmax_sigma=.5,n_cores=4, n_chains=4, burnin_steps=2000, saved_steps=2000,day_start = -1.5,day_end = 23.5)
mm6 <- metab(sp6, data=dat)

Since we’re talking about Rhat values I would try running for more iterations perhaps? If I understand your code correctly then you run 4000 iterations and you throw away half?

Thank you for your response. Yes, I will try that. I started off with 800 and kept increasing till 2000, am going to try 4000 saved steps and let you know the outcome. I hope this will resolve it.