mmcdara

3728 Reputation

17 Badges

6 years, 26 days

MaplePrimes Activity


These are replies submitted by mmcdara

Doing linear regression with Maple should not (a priori) be a complex task.
Look to Statistics:-LinearFit.

But your question leaves me dubious: why do you talk about stepwise regression in the title and not in your text?
Are you REALLY interested in stepwise regression (or an alternative like ridge or Lasso regression, ...?), i.e. a method that builds a model based on a balance between its complexity (the number of parameters it contains) and the quality of its "fit" (R^2 for example)?

I think you should provide more information about your data before expecting to get a solid answer from someone

@Kitonum 

Great, I vote up

@bstuan 

Sorry to hear that.
I suspect that a reorganization between Assistants and Tutors must have taken place since.
Hope you will get a more appropriate answer

@acer 

Sorry for this late reply.
I appreciate your many workarounds, particularly Matrix([LengthSplit(L,n)]) which is very useful in my case
(this "famous" list is produced by the command Return([seq(seq(Item(..), i=1..m), j=1..n) in a Maplet based application)

@acer 

Thank you acer, case closed.

@Kitonum 

Of course, but that was not my point.
Let's suppose you have  list L of PxQ strings and you want to organize these strings under a PxQ spreadsheet M.
It would be easier to write
M := Matrix(P, Q, L)
instead of 
M := Matrix(P, Q, (i, j)-> L[j+Q*(i-1)]) (for instance)

And my point was "why is this possible for a list of numbers or names, and not for a list of strings?
(Acer said It works in Maple 2017 onwards)

@Nikol 

I believe you use the term copula without knowing what it really means.
Look here Copula_(probability_theory)

About the "function" we were arguing about closed-forms and non closed-forms.

" In mathematics, a closed-form expression is a mathematical expression that uses a finite number of standard operations. It may contain ...., but usually no limitdifferentiation, or integration. ..." .
(https://en.wikipedia.org/wiki/Closed-form_expression)

@Nikol 

So there are no statistics or probabilities behind it.
So why do you use the term copula?

"Now I've got a function f"... No, you don't have a closed-form function in the mathematical sense, you have a procedure which takes as input a couple of values (channels) and returns another scalar value.

I guess that the main question is "Why do you want to fit your histogram ?"

@Nikol 

I think you didn't correctly inderstand the meaning of @tomleslie's reply ".[Lowess]...will not return a "closed-form symbolic" function.
Tom is right, Lowess is a smothing deterministic process, but this doesn't mean it possesses a closed form
(
A remark about "closed-form":
This term is ambiguous but a closed form is generally considered as some analytical "compact/simple/concise" algebraic expression (no derivatives nor integrals) using only simple operators and "simple" functions.
For instance the error function erf(x) is a very compact expression, but it is not a closed-form of the CDF of some gaussian random variable.

If we omit the term "compact", then Lowess has a closed form, but it is so complex that it is generally considered not closed because we cannot understand it while looking at it.

As an example let us consider a pseudo random number generator (PRNG). This is a perfectly deterministic process, based on elementary functions (+, *, mod generally). Given some seed s, there exists theoritically a function f(x, n) which gives the value of the nth pseudo random number. But this function is so complex that we say that this PRNG soes'n have any closed form.

Other examples are the solution of an ODE or the expression the determinant of a large square matrix M with abstract coefficients (even if det(M) is perfectly defined with only 6 characters).

A last one is a gaussian process emulator (Kriging for instance). Even if the expression, let's say f(x), of this emulator is quite simple, one considers that f(x) has not a closed-form. This because f(x) is, in the simplest case, defined by matrix-vector products: unfolding this compact matrix expression of f would return an intractable closed form/
)

Look here to see what Lowess is 

restart

with(Statistics):

X := Sample(Uniform(0, Pi), 200):
Yerror := Sample(Normal(0, 0.1), 200):
Y := map(sin, X) + Yerror:
L := CurveFitting:-Lowess(X, Y, fitorder = 1, bandwidth = 0.3):

# L is not a function of x defined by a closed form but a procedure
# which, for a given vlue of x, returns the perdicted value of y(x).
#
# Look at this

eval(L)

L(x)

 

proc (x1) local i, j, unnamed, arguments; unnamed := procname; if nargs = 1 and type(args[1], 'Matrix') and nvars = LinearAlgebra:-ColumnDimension(args[1]) then arguments := args[1]; return Vector(LinearAlgebra:-RowDimension(arguments), proc (i) options operator, arrow; unnamed(seq(arguments[i, j], j = 1 .. nvars)) end proc) elif nargs < nvars then error "invalid input: %1 uses a %-2 argument, %3, which is missing", procname, nargs+1, cat("x", nargs+1) elif nvars < nargs then error "invalid input: too many arguments" else arguments := map(evalf, [args]); if type(arguments, 'list(numeric)') then eval_func(L, op(arguments)) elif procname <> 'unknown' and not member(sprintf("%a", procname), {"%", "%%", "%%%"}) then return ('procname')(args) else unnamed := eval(thisproc); return ('unnamed')(args) end if end if end proc

(1)

-

Download Lowess.mw

Here is very simple example of Ordinary Least Squares (OLS) where the model a*x+b is fitted on 4 abstract data
Would you say that the model has a closed form?
Think to what it's expression would be for a larger number of points.
OLS.mw

Given the term copula you use et the end of your post, I understand that your "256 by 256 matrix" is aimed to represent the bivariate distribution of two dependent random variables X and Y.
Am I riight?

I'm waiting your answer to go further

@vv 

You're right.
I knew that, but I didn't think that might be what the OP wanted (I didn't focused on complex functions neither, an example could probably help figuring out the true problem).
@janhardo's last comment seems to prove you right

@acer 

I have just read your answer, a little by inadvertence because I had thought that dahrr had provided a definitive answer to my problem and that this thread was closed.
(which raises the question of how long a question remains "alive" and beyond which its author no longer reads the answers.)

Anyway I thank you for this alternative of @dharr 's by voting up

@dharr 

Perfect!

(among other things I particularly appreciate the command T,X,V,PX,PV:=rhs~(sol)[ ] )

PS: "I assume you have a more complex case in mind".. you assume well :-)

@Kitonum 

Great, I vote up

@acer 

What about

f := "....":
writeto(f):
CodeGeneration:-Matlab(func):
writeto(terminal):  #if necessary

I often use writeto, but I rarely hear about it here. Is this an acceptable choice  or does it have drawbacks?

1 2 3 4 5 6 7 Last Page 3 of 86