How to find the vector b if we know the RMSE?

If we have two vectors given by:
a=[3,6,8,20,35,45];
b=[3.0343, 6.2725, 8.5846, 18.3781, 34.2025, 44.9699];
Then its Mean Square Error MSE and Root Mean Sqaure Error RMSE are given by:
MSE = mean((a-b).^2,2);
RMSE = sqrt(MSE);
But if we know MSE and RMSE and one of the vector namely 'a', then how to find the 2nd vector b?

Answers (2)

Matt J
Matt J on 12 Jan 2023
Edited: Matt J on 12 Jan 2023
That's not possible. You have, in this case, 6 unknowns but only 1 equation.

1 Comment

Here's one simple solution for b:
a=[3,6,8,20,35,45];
RMSE=3.7;
b=a+RMSE;
rootMeanSquaredError = sqrt( mean((a-b).^2) ) %verify
rootMeanSquaredError = 3.7000

Sign in to comment.

There are infinitely many possible vectors b, for any given RMSE. And worse, they can have infinitely many possible shapes. This means it is flatly not possible to find a unique vector b that yields a given RMSE. Sorry.
Do you want proof?
a=[3,6,8,20,35,45];
b=[3.0343, 6.2725, 8.5846, 18.3781, 34.2025, 44.9699];
For example consider this simple vector b1:
n = length(a);
RMSEfun = @(b) sqrt(sum((a - b).^2/n));
syms x
rmsetarget = 1;
b1 = sym(a); b1(1) = x; % I will change only the first elememt of b
x1 = vpasolve(RMSEfun(b1) == rmsetarget,x)
x1 = 
0.55051025721682190180271592529411
b1 = double(subs(b1,x,x1))
b1 = 1×6
0.5505 6.0000 8.0000 20.0000 35.0000 45.0000
RMSEfun(b1)
ans = 1.0000
So by trivially changing one arbitrary element of a, I found a new vector b that yields exactly the desired RMSE. I could have perturbed ANY element and gotten the same result.
b2 = sym(a); b2(4) = x; % I will change only the first elememt of b
x2 = vpasolve(RMSEfun(b2) == rmsetarget,x)
x2 = 
17.550510257216821901802715925294
b2 = double(subs(b2,x,x2))
b2 = 1×6
3.0000 6.0000 8.0000 17.5505 35.0000 45.0000
RMSEfun(b2)
ans = 1.0000
Or, I might have chosen b in a different way.
b3 = sym(a); b3 = b3*x; % I will change EVERY element of b, proportionally
x3 = vpasolve(RMSEfun(b3) == rmsetarget,x)
x3 = 
0.96004791377243790210022857429935
b3 = double(subs(b3,x,x3))
b3 = 1×6
2.8801 5.7603 7.6804 19.2010 33.6017 43.2022
RMSEfun(b3)
ans = 1.0000
Again, there are infinitely many solutions. I chose only 3 trivial examples.

10 Comments

Thanks a lot dear Matt J and John D'Errico for your kind responses. Ok If we have vector 'a' as above and we have a matrix C like below:
a=[3,6,8,20,35,45];
C=[3.06181363232819 5.96396501049181 8.25079270073043 19.3505885706877 34.7265808000449 44.8913140030355
3.64001925634431 5.98364764723370 7.12130211241516 22.8057608404000 36.1740001634801 45.3970372885559
3.17011616342810 6.05427732183907 7.91500668708759 19.9901769028977 35.1392373306947 45.0414427941172
3.49623311262451 5.85707368306556 7.22998790626857 23.3316283132859 36.0831540000424 45.2112712565938
2.92047890619507 5.98073992423870 7.34629031683134 21.2274196556183 35.6133968156586 45.2249296263882
3.28122649019689 6.02197261480197 7.41012412411829 21.8214811093497 35.8433664638944 45.1754763409129
3.05055366989385 5.84500765946933 7.61619649499705 20.3444163443428 35.1600477907806 45.0203965490118
3.35137473414291 6.10591183779609 7.32913457862805 21.9676479850177 36.2969052709137 45.4852890551514
2.99792332258418 6.19555775159305 8.23992097434602 18.1929809703303 34.4571498128698 44.9129222625995
2.70762350515748 5.71793601618055 7.99634975738420 20.9545663754584 34.9282939099770 44.8266237805697
2.72993580293976 5.97668202364062 7.90347847954929 19.8450798182115 34.8470433236845 44.7384449308857
3.52252967239948 6.25064919405331 7.30104417950632 22.7736601823865 36.2583066749613 45.4735956835323
3.58799168878030 6.16090800852346 7.79338617886263 18.6363451925863 34.6056000650003 45.0579200938259
2.89980201196849 6.17299107034898 7.96656134906137 19.1264729797469 34.7318506628196 44.9088362540612
2.80641348052595 5.85937240368011 8.36046805043236 17.9523361529969 34.3210666838908 44.5816784232150
3.35108056904191 6.02600494921349 7.10138149096324 23.3582711432715 36.9285417417436 45.6235211401919
3.40930601706609 5.46074415567056 7.35724139097203 22.2846204622025 36.5023931695037 45.5367023417295
2.82041760258753 5.74391909232112 8.02198530637453 19.6817967543074 35.0389171515998 44.6992654809265
3.25958459443168 5.99361694362547 7.35255548288549 21.7677612028838 36.1524948175466 45.4770017095515
3.51114112386012 6.21148662476894 7.24964397380967 22.1982330695283 36.3063556903631 45.5239357081812
2.29584903911312 5.83549400284958 8.54054844745186 18.5537438829656 34.0853573877348 44.5350320841707
3.61218359357534 5.85147244384986 7.99202838603309 21.0812059027521 35.0824577747278 44.9500404294298
3.55377981739408 6.08975103162044 6.48702470271272 25.2885798683930 37.8306434788573 46.1055286331553
2.24245142507239 6.11915900360233 8.49006459096238 15.4481575399741 33.1797482761758 44.3782537528582
3.26564292723495 6.09052787524414 7.95176634970064 21.7575437650067 35.5791040128730 45.1802246755359
2.48626946032580 6.01819868762952 8.23437709281147 18.6786644149176 34.3924265721998 44.7174243468455
3.04474387497122 5.99632070648553 7.72168979585755 21.2822602414133 35.0917061049533 45.0999309780041
2.97132191442379 5.77809404551583 7.53511830859875 22.7227532111206 35.9170757823308 45.0668787918347
3.43571877641989 5.90022479161200 7.86354828844215 21.1146979172011 35.4986177116211 45.1800685051214
3.36342216734938 5.91413292832505 7.66211483090569 19.9467835547251 35.1325939287918 44.9803752275789
2.99114623645280 5.77436749773500 7.73875951025142 20.8110178555897 34.9166197510954 44.8521266732482
3.74788699378821 6.09077875356616 6.65878127532021 23.4578457136708 37.0161347867600 45.8588086413667
3.53960487171837 6.08873356596946 6.73644916679078 22.8308974217458 36.8948813771955 45.6902746612877
2.64095118721226 5.93482635110647 7.87164798158551 19.1998896662842 34.3033821630704 44.5493763520004
3.20620519654466 5.99037026523446 7.56775240647675 21.6637252749642 35.8933215291068 45.4240766541374
2.90757183520566 5.94984883453035 7.79431793181772 19.8310792707498 34.8809789520528 44.9724156686921
3.14127233980399 6.14035723192385 7.42691470227650 23.0647333785142 35.6336203979671 45.2455577737031
3.37231538168801 6.00604735034748 8.13531894178816 20.1381803643340 35.2739743173277 45.1642479318647
3.05409695118852 6.13175079188580 8.05311990854475 19.1457183327093 34.7266641695383 44.9376513790470
2.83923126708206 6.01802157985948 8.01630562859383 19.7023750712290 34.7288880986983 44.7248446241133
3.21650812888087 5.84012971332292 7.97756081678195 20.4116492893986 35.2246819834515 45.0960279732789
2.47436621845811 5.64663754798863 7.98277511873552 20.8657490985375 34.9490184013146 45.0052042302480
3.33077916258149 6.17202310810380 7.71752912195908 21.2369438540115 35.4844036732228 45.2401484923104
3.51836980671015 6.26907798512552 7.47611827970451 21.8629128188055 35.6340883270279 45.3898335266407
3.11787502230456 5.53497495094766 7.37478973469679 21.5908786697722 36.2190579579977 45.2699751973316
3.41687682208616 5.98773658182777 8.37484252814834 21.2092966255901 35.6716459124982 45.2699527417330
2.96466922968465 6.16393956479268 8.04159422356011 20.6684303274655 35.4278420310650 45.2084435902796
3.32474182746288 6.04741718104917 6.37747247657930 26.1190233305269 37.6566544026611 45.8879752141604
2.75600773839185 6.06846441388402 7.64308244981665 21.6352718011813 35.7491634975853 45.3197138478112
2.90776150033578 5.95585351321632 7.59244820802842 22.6069994030822 36.2554360950468 45.4642258642193
3.30661696996288 5.85137325215910 7.49047516990492 21.4550750391531 35.6636829506993 45.1592258431526
3.29681093918724 5.97381195653750 7.84010834147814 20.3548509211370 35.2551081094494 45.1385757677216
2.77059240289126 5.87701489831775 8.01023522712290 17.8686443734179 34.1147673132632 44.6224480898093
3.19087794514061 6.03406058821330 8.21016596305990 20.0598994023779 34.9031485269876 45.0100576935752
2.77419370832795 5.73578361735032 7.93565309751826 19.3270418326096 34.6891553019825 44.9661943488721
3.35371293975863 6.55495527031325 7.57550437758558 20.9725407438628 35.6462049864952 45.3380349598383
3.03024988571427 6.12954274986963 8.12933028160170 22.6853072854205 36.2019355410636 45.4525592454471
2.82880230213902 6.08628346540213 8.14937526855258 20.4898792850174 34.9823877851767 44.8734336101725
3.59809358151616 5.93095732502467 7.30550902656001 22.9657557804347 36.4822975437894 45.5349864431456
3.27893548966474 5.95686576174613 7.19490078050851 23.6727651860279 37.0651562572697 45.8623307523661
3.74970191843468 6.33374448808416 6.71895893016287 23.5300187531225 37.3100472455620 45.9953672890887
2.89820634763269 6.11084839071748 7.93358074224729 21.4127856322212 35.5521107686301 45.1974030181117
3.48302053562852 6.21468796903211 7.65730070858571 22.1177465597439 35.9568194563380 45.6122581225029
3.65060217406274 5.80741627134660 7.86741030155943 20.9124338714913 35.3228734375037 45.0070429607647
3.11560272645808 5.82692849886746 8.41831361085076 19.8196219409120 34.8352250855341 44.9505352973710
3.83051511617102 6.28347059234528 6.62587680015654 24.4769298597694 37.4119999202422 45.8228972232651
2.65079093356038 5.48112592826721 7.73991838133814 21.9886077847821 35.6838413286826 45.0149434093148
2.73731810473870 5.74214668513713 7.58743663290870 22.9103735101729 35.8672347836476 45.2277615671829
3.40201605544853 6.27790095056006 7.12842444790291 22.9429694365717 36.5653856735330 45.6774176349821
3.94018199667914 5.84248455577022 6.65154139649531 25.1242425768365 37.9365809615722 45.8298359769128
3.32575201997402 5.93365733110741 7.81554398750806 21.8481000230686 35.3637232308201 45.1020930797667
2.90019786899456 5.93724497780101 7.78052654122994 19.1000347354423 34.6715666102677 44.7428208044880
3.35233919868015 5.32627874068234 6.29351713003076 24.8600653190066 37.7033727189708 45.8048963414889
2.85688555580955 5.75494649211542 8.53246809462648 17.8499224906123 33.9037870754662 44.4794449790230
2.88075164671379 6.02070698097154 7.70249566232490 21.7394861208954 35.4146575894307 45.1574646680885
3.29130780260455 6.24847008395789 7.42804606437577 22.2079506918747 36.1756417771051 45.5191043478324
3.31809736987560 6.00599610964350 7.56390483648941 22.2081720643857 36.1566319347143 45.4570835652416
3.35596434219596 5.81652093061360 7.49187380460815 22.2835815236262 35.8735114736686 45.3990479773432
3.18656223581782 5.86683957165756 7.43720102783068 22.5506214040870 36.7937131916687 45.6545462901012
2.64077813257503 5.81236262802082 7.93777718359068 19.5541952751087 34.5580691765605 44.9496374844442
3.65006744031758 6.20382268497635 6.78672927679406 23.8490663381923 37.3651312569556 45.9991247783639
3.74767050746826 6.61504878435988 6.87884618799552 24.4472761030029 37.5485776203323 46.0897335861142
2.68844165995351 6.03931939958729 8.37430013673645 17.0870537982334 33.6334282742943 44.3833025020339
2.62054651418076 5.93185797914460 7.77104714502923 20.8081986276793 35.2269290104115 45.1161732889870
3.30841995840698 5.97158072463165 7.33788252641810 22.1187999635024 36.2200278272868 45.5914832289491
3.10103975930973 5.72982416665390 7.51541039393971 21.8839767155586 35.8271676838862 45.2842238428012
3.84303016803870 6.22819772020755 6.79423198126980 24.0807943918709 37.4054910123664 45.8415416034950
2.80907324554871 6.13462234042477 7.90490687076948 20.3184791571846 35.0721327941573 45.0470761625650
3.41281719706610 5.36715775148355 7.27158565256160 21.1216322280325 35.4091106480877 44.8146754767184
2.95711451039460 5.89220164854351 8.26564524551711 19.2674759701783 34.4654553239045 44.7055987388237
3.75968413330627 6.26327143837108 7.09137709788582 23.4058562655476 37.2198439372000 46.0346427131310
3.39184594385267 6.00194106724290 7.64519315736743 21.5050985397539 35.4255264508545 45.2005055769687
3.26187135300294 6.23065919912977 8.35742072579332 20.4605881241588 35.3677080112872 45.2518807723672
2.86569975049581 5.97536308994709 8.48798555737800 18.8170057482218 34.8226122662561 44.9462972651760
3.40866176193584 5.70664874630864 7.28150595256083 22.8938572547888 36.2303217310112 45.3446098712551
2.93466564723072 5.97652046822375 7.57545088710525 21.1613590586160 35.7222655608491 45.2220795373392
3.77584809038320 6.48500805420988 6.77399342073342 24.0615839749439 37.7513968709761 46.3510729154031
2.74849459020479 5.69521532591511 8.03237221095755 18.0705773461830 34.1941845422416 44.8989749639214
3.07422286585787 6.23748232957458 8.05274981119599 20.1044920269881 34.4540600765602 44.8930137875219
3.03431689503796 6.27247141873906 8.58457086719847 18.3780622908586 34.2025151061166 44.9699143790029];
And we find its RMSE given below:
RMSE=[0.309925349536485
1.32854625508834
0.100258360121278
1.48195811952683
0.628150579881412
0.864809907233644
0.230411719324083
1.03068337172397
0.781387212199642
0.430398162933991
0.181934907865268
1.31181940341704
0.636759421360166
0.383915798346207
0.914335796849431
1.64911521639988
1.19973554075008
0.220423729686980
0.928023339651249
1.13154234351589
0.812353212365206
0.512379120908612
2.57577285073583
2.05131650936839
0.767885671103765
0.647315621057416
0.538835110529774
1.19199171447276
0.538829093097871
0.213858787094643
0.366470498459897
1.78538007836936
1.52625044501880
0.496345397898337
0.813971482965366
0.127033024692744
1.30527448552268
0.215290366969390
0.372268601458720
0.209853114694237
0.224386681935183
0.438482287814006
0.583258792765323
0.879397959864566
0.886088271283586
0.619250170277863
0.342332966622459
2.82928319318677
0.766940511780096
1.20862364183965
0.702233428268855
0.232576316093124
0.960617605349140
0.125720290771078
0.335554080457334
0.590334473888534
1.21756292335773
0.229266007817692
1.42149712083561
1.79004372052030
1.87539379361390
0.628068245521539
1.01423670298790
0.485589699807721
0.216193503346578
2.20590608472883
0.901964791696282
1.26358907561752
1.44734733529171
2.52643000385019
0.785571026877701
0.417535300857816
2.41752091045457
1.03758926040220
0.744502718006506
1.08015261982739
1.05783958815740
1.04527297632092
1.32418448220170
0.306784642351348
1.97245891688670
2.22318517660875
1.35226999687439
0.391413192446921
1.06942068971933
0.878672192860379
2.05605255803595
0.169542119628818
0.653359315068986
0.406822773422638
1.78279167608156
0.678973706925456
0.331743970571321
0.530816859521561
1.34015859920727
0.592284213820656
2.16919003141260
0.869809655010314
0.253345767225850
0.783657094970932];
Then how can we find the whole matrix again if we bring some changes in the given RMSE? like if I change the RMSE as below:
RMSE1=RMSE-0.000000000000012;
Now how can we find the new matrix C1 of the same size as is C?
I think now we have more than 6 equations.
I'm sorry, but NO.
You have a matrix C, and a vector a.
size(C)
ans =
100 6
size(a)
ans =
1 6
For every row of C, you subtract the vector a. And then compute an RMSE against each row of C. That allowed you to compute an RMSE for each row.
Now you tell us that you want to change the RMSE by some constant amount.
The matrix C has 100*6 = 600 elements. Now you want to infer what the =value of all 600 unknown elements, having specified only 100 numbers?
You did not think about my answer, did you? Now you have 600 unknowns. And you have 100 equations. Is 600 SIGNIFICANTLY greater than 100?
Even if you have only 1 more unknown than you have equations, you cannot solve the problem uniquely. But with 500 more unknowns than you have equations, you somehow think it is possible to solve this problem?
Let me say it again. YOU CANNOT INFER THE VALUE OF 600 UNKNOWNS FROM ONLY 100 PIECES OF INFORMATION.
Just wanting a problem to have a solution is not sufficient for it to have a solution. Just wanting a solution very badly does not make the solution suddenly possible.
Thank you very much dear John D'Errico for your kind response. Yes, mathematically such a system in which unknowns are more than no. of equations cannot be solved uniquely. But actually I was thinking about the formula of RMSE. Since formula is:
RMSE=sqrt((a-b)^2/N), where N is the number of elements in a or b. Now if we sqaure its both sides mathematiclly, then RMSE^2 = (a-b)^2/N. This implies that
(a-b)^2=N*RMSE^2 or a-b=sqrt(N*RMSE^2) or b=a-sqrt(N*RMSE^2). So isn't it possible then?
I think you have to look up the formula for RMSE. Where is the sum in your expression RMSE=sqrt((a-b)^2/N) ?
Thanks a lot dear Torsten for your kind response. Yes you are right. But here I have taken a and b as vectors e.g
a=[x1 x2 x3 x4] and b=[y1 y2 y3 y4], Now since the last step above is:
b=a-sqrt(N*RMSE^2), so it will be
[y1 y2 y3 y4]=[x1 x2 x3 x4]-sqrt(N*RMSE^2), Now since in given post, the value of 'a' is known i.e., a=[3,6,8,20,35,45]; and value of sqrt(N*RMSE^2) is also known because RMSE is known, so [y1 y2 y3 y4] i.e., b can be found easily. Isn't that?
Isn't that?
No.
N * RMSE^2 = (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 + (x4-y4)^2
Now show me how you want to solve uniquely for y1, y2, y3 and y4 given N, RMSE and x1, x2, x3 and x4.
As noted several times by other participants, you have only 1 equation (the one above), but 4 unknowns.
Matt J
Matt J on 13 Jan 2023
Edited: Matt J on 13 Jan 2023
As noted several times by other participants, you have only 1 equation (the one above), but 4 unknowns.
Yes. In fact the equation is that of a hypersphere of radius sqrt(N)*RMSE and centered at a. Any point b on the surface of this hypersphere is a solution.
I will keep on saying it. You do not have sufficient information to solve for the unknowns. It is one equation only. And you have multiple unknowns. In your last example, we have:
a = [3,6,8,20];
With N and RMSE given, we have
N = 4;
RMSE = 1; % I'll just pick a number for RMSE
syms y [1,4]
ans = 
N * RMSE^2 == sum((a - y).^2)
Do you recognize this as the equation of a sphere in 4 dimensions? If not, you should. The center of the sphere is the point a=[3 6 8 20], and the square of the radius is given here as 4=2^2.
But ANY point on the surface of that sphere is a solution to your problem. ANY point. Need I repeat that? ANY POINT. How many points lie on the surface of a sphere? (Infinitely many.)
There is NO solution to your question. You cannot solve for the unknown vector (here y or b as you prefer.) You can keep on insisting there is a solution, but the mathematics says you are completely wrong. There are infinitely many solutions and there is no way to choose any specific solution, beyond saying the solution lies SOMEWHERE on the surface of that sphere.
Thanks a lot for your kind response. Amazing explanation. Yes, I am convinced with your explanation. But is there any trick that we can use because most of the time tricks also work though trick may be against mathematics rules? Isn't that?

Sign in to comment.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Asked:

on 12 Jan 2023

Edited:

on 14 Jan 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!