herclau

Mr. Hermes Rozsa Iglesias

1038 Reputation

13 Badges

19 years, 133 days

MaplePrimes Activity


These are answers submitted by herclau

Run the instructions and get this:
It's what you want?

this give me a graph...

Statistics[Fit](p1*x1+p2*x2+p3, independentDataMatrix, LIPO, [x1, x2]);

  -0.399224485713786436 x1 - 0.239079452680029364 x2 + 2.56176858831106546

g1 := plots[pointplot3d](REDOX, IC50, LIPO);

plots[display](plot3d(-.399224485713786436*x1-.239079452680029364*x2+2.56176858831106546, x1 = -1 .. 1, x2 = 0 .. 5, color = grey, style = wireframe), g1, axes = normal, axis[2] = [color = grey], axis[3] = [color = red], thickness = 3, font = [HELVETICA, BOLD, 11], title = "Correlation IC50 REDOX LIPOPHILIE", color = blue, symbol = solidsphere, labels = ["REDOX", "IC50", "LIPO"]);
 

the graph

I hope this helps ...
f := proc (p, r, i) r[i, 3]-p[1]*r[i, 1]-p[2]*r[i, 2]-p[3] end proc;
H := Statistics[NonlinearFit](3, f, <<(REDOX)>|<IC50>|<LIPO>>, output = solutionmodule);
 
H:-Results();
 ["residualmeansquare" = 0.0626631103666510,
 "residualsumofsquares" = 0.250652441466604,
 "residualstandarddeviation" = 0.250326008170647,
  "degreesoffreedom" = 4,
   "parametervalues" = ...
   "parametervector" = ...
   "residuals" = ...
You could see a bit more with this:

infolevel[Optimization] := 10;
 infolevel[Statistics] := 3;

 

Please show the way, criticize, make a comment

All we want is to show that Maple can do what is shown on the attached pdf document. From my knowledge of Maple, I can not prove it.

Download 9494_Data_Analysis_Extension_Pack_Calibrating.pdf
View file details

 

 HerCalu

My  Maple worksheet :

View 9494_Data_Analysis_2.mw on MapleNet or Download 9494_Data_Analysis_2.mw
View file details

How to introduce the range of parameters, LSSolve and NonlinearFit
used in Matrix Form?


Why, when I introduce the SQP method in LSSolve, I get error?

with(Optimization):

infolevel[Optimization] := 10:
with(Statistics):

infolevel[Statistics] := 3:
 
data := Matrix(10, 2, [ 0,  0.,  1, 2.0,  2, 7.29, 3, 13.72, 4,  21.92,  5,  32.57, 6,  35.48,  7,  50.11,  8,  57.67,  9,  82.47]):
 
N := LinearAlgebra:-RowDimension(data);

K := 2;

Poly := proc (p, k) options operator, arrow; p[1]*k^p[2] end proc:
 

z:=x->Poly(<A, b>, x):
 
ff := proc (p, v, i) Poly(p, v[i, 1])-v[i, 2] end proc:
 

gg := [seq(proc (p, r, i) diff(Poly(p, r[i, 1]), p[j]) end proc, j = 1 .. K)]:
 

f := proc (w, z, needfi, ruser) local i; global N; for i to N do z[i] := evalf((proc (p, r, i) p[1]*r[i, 1]^p[2]-r[i, 2] end proc)(w, ruser, i)) end do end proc:

g := proc (w, z, ruser, iuser) local i; global N; for i to N do z[i, 1] := evalf((proc (p, r, i) r[i, 1]^p[2] end proc)(w, ruser, i)); z[i, 2] := eval*f((proc (p, r, i) p[1]*r[i, 1]^p[2]*ln(r[i, 1]) end proc)(w, ruser, i)) end do end proc:

H := NonlinearFit(K, ff, data, modelfunctiongradient = gg, initialpoint = <2.0, 2.0>, iterationlimit = 1000, output = solutionmodule);

In NonlinearFit (Matrix form)
LSSolve: calling nonlinear LS solver
LSSolve: using method=modifiednewton
LSSolve: number of problem variables 2
LSSolve: number of residuals 10
LSSolve: optimality tolerance set to 0.3256082241e-11
LSSolve: iteration limit set to 1000
LSSolve: trying evalhf mode
attemptsolution: conditions for a minimum are not all satisfied, but a better point could not be found
attemptsolution: number of major iterations taken 6
attemptsolution: number of times the objective was evaluated 32
               module () export Results, Settings; end module
H:-Results();

 
r := [<2, 1>, <3, 2>]:
 
NonlinearFit(K, ff, data, modelfunctiongradient = gg, parameterranges = r, iterationlimit = 100);

In NonlinearFit (Matrix form)
LSSolve: calling nonlinear LS solver
LSSolve: using method=sqp
LSSolve: number of problem variables 2
LSSolve: number of residuals 10
LSSolve: number of nonlinear inequality constraints 0
LSSolve: number of nonlinear equality constraints 0
LSSolve: number of general linear constraints 0
LSSolve: feasibility tolerance set to 0.1053671213e-7
LSSolve: optimality tolerance set to 0.3256082241e-11
LSSolve: iteration limit set to 100
LSSolve: infinite bound set to 0.10e21
LSSolve: trying evalhf mode
LSSolve: trying evalf mode
Error, (in Statistics:-NonlinearFit) bad index into Vector

LSSolve([seq(z(data[i, 1])-data[i, 2], i = 1 .. N)], A = 2 .. 3, b = 1 .. 2);
print(`output redirected...`); # input placeholder
LSSolve: calling nonlinear LS solver
LSSolve: using method=sqp
LSSolve: number of problem variables 2
LSSolve: number of residuals 10
LSSolve: number of nonlinear inequality constraints 0
LSSolve: number of nonlinear equality constraints 0
LSSolve: number of general linear constraints 0
LSSolve: feasibility tolerance set to 0.1053671213e-7
LSSolve: optimality tolerance set to 0.3256082241e-11
LSSolve: iteration limit set to 50
LSSolve: infinite bound set to 0.10e21
LSSolve: trying evalhf mode
attemptsolution: number of major iterations taken 8
  [47.6485846701928254, [A = 2.00668349119911138, b = 1.66139426833885918]]

LSSolve([K, N], f, datapoints = data, objectivejacobian = g, method = sqp);

LSSolve: calling nonlinear LS solver
LSSolve: using method=sqp
LSSolve: number of problem variables 2
LSSolve: number of residuals 10
LSSolve: number of nonlinear inequality constraints 0
LSSolve: number of nonlinear equality constraints 0
LSSolve: number of general linear constraints 0
LSSolve: feasibility tolerance set to 0.1053671213e-7
LSSolve: optimality tolerance set to 0.3256082241e-11
LSSolve: iteration limit set to 50
LSSolve: infinite bound set to 0.10e21
LSSolve: trying evalhf mode
LSSolve: trying evalf mode
Error, (in Optimization:-LSSolve) invalid input: f uses a 2nd argument, z, which is missing


LSSolve([2, N], f, datapoints = data, objectivejacobian = g, initialpoint = <2.0, 2.0>);

LSSolve: calling nonlinear LS solver
LSSolve: using method=modifiednewton
LSSolve: number of problem variables 2
LSSolve: number of residuals 10
LSSolve: optimality tolerance set to 0.3256082241e-11
LSSolve: iteration limit set to 800
LSSolve: trying evalhf mode
attemptsolution: conditions for a minimum are not all satisfied, but a better point could not be found
attemptsolution: number of major iterations taken 6
attemptsolution: number of times the objective was evaluated 32
             [47.6485846702831, Vector[column]([[2.00668289393925336],[1.66139446467723118]])]
 

Gracias

HerClau

Globally  MathCad's residuals with Rational adjustment seems better, against all the adjustment we've seen.
Following the idea exposed
For MathCad
max(Rsiduals)=0.0841
min(Residuals)=-0.000277
MathCad Residual

We have obtained: most of the time giving up 
the RationalInterpolation

  [max,min]
1 [5.1427194, -0.963936e-1]
2 [41.60406720, -36.6868917]
3 [5.02832500, -1.08863820]
4  [.9462131, -.7915880]
5  [.3409254, -.4098711]

Regression Functions MathCad
rationalfit(vx, vy, conf, m, n, [Stdy], [LBUB], [Acc], ["noscale"]) 
Takes real vectors vx and vy of identical length, 
the desired confidence limit conf, a percentage expressed as a number between 0 and 1, 
inclusive, and integer polynomial orders m and n for the top and bottom of the rational function to be fit. 
An additional optional vector of standard deviations in y, Stdy, the same length as vy, an optional two-column 
matrix of lower and upper bounds on the parameters, LBUB, with m + n rows, and an optional convergence accuracy Acc, 
may be specified. If the optional string argument "noscale" is supplied, input data will not be scaled to the range 0 to 1 before calculating.
 Returns a three-column matrix, where the first column contains the values for the fitted parameters, and the second and third columns
 contain the left and right boundaries, respectively, for the confidence interval on the parameters.
 

Gracias

HerCalu

Within the worksheet are the images.
Residuals, that I am getting, many more of which can be seen in the MathCad sheet View 9494_Data Analysis Images.mw on MapleNet or Download 9494_Data Analysis Images.mw
View file details
I shall do that tell me this comment.
And I hope that the images inside the file to guide us. HerClau

 

 

How to obtain results similar to those shown MathCad?
I used CurveFitting [RationalInterpolation] and Statistics [Fit] and not achieving the expected results. In the worksheet I show it implemented. Can you guide me?

MathCad 1

 

MathCad 2

View 9494_Data Analysis.mw on MapleNet or Download 9494_Data Analysis.mw
View file details

 

Corrected function, something was wrong when the paste.

g := (c0+c1*k+c2*k^2+c3*k^3+c4*k^4+c5*k^5+c6*k^6+c7*k^7)/(1+c8*k+c9*k^2+c10*k^3+c11*k^4+c12*k^5+c13*k^6)

Excuse

HerClau

How to find the best fit the data X, Y for the function:
Up := 7; Down := 6;
g := add(c || i*k^i, i = 0 .. Up)/(1+add(c || (Up+i)*k^i, i = 1 .. Down));


                          2       3       4       5       6       7
          c0 + c1 k + c2 k  + c3 k  + c4 k  + c5 k  + c6 k  + c7 k
          ---------------------------------------------------------
                           2        3        4        5        6  
            1 + c8 k + c9 k  + c10 k  + c11 k  + c12 k  + c13 k   

with confidencelevel = 0.95?

Gracias

HerClau

 

Thanks Eric for the time dedicated and you answer.

I Only can accede from my work, from here my delay in thanking your answer.

In your answer I can see the handling and combination of some functions:

expr5: = map (x @ normal, collect (rhs (EQ4), (Deltaw `&`, m [cr ]}));

factor (normal (.....)
expand (normally ...)

That I had not seen them before. And that his knowledge helps very much in order to obtain result looked up. Where may find examples that they assist me in the assimilation of the same ones?

The simplification of mathematical expressions is for me very difficult. I know that Maple has all of the potential to execute it, and than only in the course of time and a lot of training will be possible to dominate itself. But the need and the precipitation of answers for moment he does not give us the time for the learning.

I ask for excuse if I was aggressive when requesting answer.

PatrickT thanks for the words and the tip.

Gracias

HerClau

 

 

Yes I want to reproduce the paper in Maple, with all approches and neglections.

You get the idea and I'm sorry cause when I write the equations in the forum I made a mistake. If you see the .pdf, you would not find any m[a] this is a mistake. I want to obtain m[ct].

Gracias Erik

HerClau

 

 

http://www.mapleprimes.com/blog/bthur/introducingrick

Here We can read:

"his primary role within the Primes community is to pay close attention to your questions, to make sure that help is being offered where needed,.."

" I will keep an eye on things to make sure that no one's questions are left unattended"

"I look foward to reading your posts from here on out! "

And we can Expect thatt!!!!!!!!!

Sorry, but in recent times, I do not get answers to questions.
At times it is gratifying to know:
It isn't of interest to the Forum your question ...
We have already seen, ..
It is not wise your question, study a little more ...
Believe it or not, with these answers you feel cared for, and inspired to keep questioning.

Gracias

HerClau

 

 

restart;
From  
m[t]*(1-rho[a]/rho[t]) = m[r]*(1-rho[a]/rho[r])+`&Deltaw`;

 and
m[t] := m[ct]*(1-rho[0]/rho[c])/(1-rho[0]/rho[t]);
 
 m[r] := m[cr]*(1-rho[0]/rho[c])/(1-rho[0]/rho[r]);
 

I need to get

m[a] = m[a]*(1+C)+`&Deltaw`;
C = (rho[a]-rho[0])*(1/rho[t]-1/rho[r]); Developing m[t]*(1-rho[a]/rho[t]) = m[r]*(1-rho[a]/rho[r])+`&Deltaw`; I got /    rho[0]\ /    rho[a]\         /    rho[0]\ /    rho[a]\          
m[ct] |1 - ------| |1 - ------|   m[cr] |1 - ------| |1 - ------|          
      \    rho[c]/ \    rho[t]/         \    rho[c]/ \    rho[r]/          
------------------------------- = ------------------------------- + &Deltaw
              rho[0]                            rho[0]                     
          1 - ------                        1 - ------                     
              rho[t]                            rho[r]       isolate(m[ct]*(1-rho[0]/rho[c])*(1-rho[a]/rho[t])/(1-rho[0]/rho[t]) = m[cr]*(1-rho[0]/rho[c])*(1-rho[a]/rho[r])/(1-rho[0]/rho[r])+`&Delta;w`, m[ct]);
              /      /    rho[0]\ /    rho[a]\           \            
              |m[cr] |1 - ------| |1 - ------|           |            
              |      \    rho[c]/ \    rho[r]/           | /    rho[0]\
              |------------------------------- + &Deltaw | |1 - ------|
              |              rho[0]                      | \    rho[t]/
              |          1 - ------                      |            
              \              rho[r]                      /            
      m[ct] = ---------------------------------------------------------
                              /    rho[0]\ /    rho[a]\               
                              |1 - ------| |1 - ------|               
                              \    rho[c]/ \    rho[t]/    simplify(m[ct] = (m[cr]*(1-rho[0]/rho[c])*(1-rho[a]/rho[r])/(1-rho[0]/rho[r])+`&Deltaw`)*(1-rho[0]/rho[t])/((1-rho[0]/rho[c])*(1-rho[a]/rho[t])), 'symbolic');                                      1                              
m[ct] = - -------------------------------------------------------- ((
          (-rho[r] + rho[0]) (-rho[c] + rho[0]) (-rho[t] + rho[a])  
-m[cr] rho[c] rho[r] + m[cr] rho[c] rho[a] + m[cr] rho[0] rho[r]
   - m[cr] rho[0] rho[a] - &Delta;w rho[c] rho[r] + &Deltaw rho[c] rho[0]) (
-rho[t] + rho[0]))
rhs(m[ct] = -(-m[cr]*rho[c]*rho[r]+m[cr]*rho[c]*rho[a]+m[cr]*rho[0]*rho[r]-m[cr]*rho[0]*rho[a]-`&Deltaw`*rho[c]*rho[r]+`&Deltaw`*rho[c]*rho[0])*(-rho[t]+rho[0])/((-rho[r]+rho[0])*(-rho[c]+rho[0])*(-rho[t]+rho[a])))
                             1                              
- -------------------------------------------------------- ((
  (-rho[r] + rho[0]) (-rho[c] + rho[0]) (-rho[t] + rho[a])  
-m[cr] rho[c] rho[r] + m[cr] rho[c] rho[a] + m[cr] rho[0] rho[r]
   - m[cr] rho[0] rho[a] - &Delta;w rho[c] rho[r] + &Delta;w rho[c] rho[0]) (
-rho[t] + rho[0])) factor(-(-m[cr]*rho[c]*rho[r]+m[cr]*rho[c]*rho[a]+m[cr]*rho[0]*rho[r]-m[cr]*rho[0]*rho[a]-`&Deltaw`*rho[c]*rho[r]+`&Deltaw`*rho[c]*rho[0])*(-rho[t]+rho[0])/((-rho[r]+rho[0])*(-rho[c]+rho[0])*(-rho[t]+rho[a])));                             1                              
- -------------------------------------------------------- ((
  (-rho[r] + rho[0]) (-rho[c] + rho[0]) (-rho[t] + rho[a])  
-m[cr] rho[c] rho[r] + m[cr] rho[c] rho[a] + m[cr] rho[0] rho[r]
   - m[cr] rho[0] rho[a] - &Deltaw rho[c] rho[r] + &Deltaw rho[c] rho[0]) (
-rho[t] + rho[0])) My attempts using other functions of maple without unsuccessful.
Any suggestions? Gracias HerClau
 
3 4 5 6 7 8 9 Page 5 of 10