I am not sure what the exact aim is and time does not permit refining some loose ends. Assuming reason to believe data is ellipsoid (as test data is):
Using test data from another answer:
data = Flatten[
Table[{RandomReal[{1.9, 2.1}] Cos[n/100 2 Pi] Sin[m/100 Pi],
RandomReal[{0.9, 1.1}] Sin[n/100 2 Pi] Sin[m/100 Pi],
RandomReal[{0.9, 1.1}] Cos[m/100 Pi]}, {m, 100}, {n, 100}], 1];
Fit:
model = {#1^2, #2^2, #1, #2, #3, #1 #2, #1 #3, #2 #3, #3^2} & @@@ data;
lmf = LinearModelFit[
model, {1, x2, y2, x, y, z, xy, xz, yz}, {x2, y2, x, y, z, xy, xz,
yz}]
fun[u_, v_, w_] :=
lmf["BestFitParameters"].{1, u^2, v^2, u, v, w, u v, u w, v w}
Volume:
reg = ImplicitRegion[fun[x, y, z] > z^2, {x, y, z}];
dreg = DiscretizeRegion[reg];
Volume[reg]
yields: 8.45783
See original answer for graphics and examples of model properties. Only difference data used.
Original Answer (based on misunderstanding)
ConvexHullMesh
provides an enclosing convex volume:
ch = ConvexHullMesh[data]
Fitting:
chv = ch["VertexCoordinates"];
mod = {#1^2, #2^2, #1, #2, #3, #1 #2, #1 #3, #2 #3, #3^2} & @@@ chv;
lm = LinearModelFit[
mod, {1, x2, y2, x, y, z, xy, xz, yz}, {x2, y2, x, y, z, xy, xz,
yz}]
f[u_, v_, w_] :=
lm["BestFitParameters"].{1, u^2, v^2, u, v, w, u v, u w, v w}
The model is reasonable and (as how data generated implies) suggests dropping cross and translation terms (I won't do for time sake).
Show[ContourPlot3D[
f[u, v, w] - w^2 == 0, {u, -2, 2}, {v, -2, 2}, {w, -2, 2},
Mesh -> False, ContourStyle -> Opacity[0.3]],
Graphics3D[Point[data]]]
The equation: 1.17889 + 0.00294153 x - 0.277082 x2 - 0.00261799 xy -
0.000551349 xz - 0.00163403 y - 1.01096 y2 - 0.00399276 yz +
0.0000264809 z=z^2.
Again, this could clearly be simplified but I do not have time to reduce/simplify model.
Volume of region can be determined in a number of ways:
, e.g. Volume[ch]
yields: 9.95036
ir = ImplicitRegion[f[x, y, z] > z^2, {x, y, z}]
DiscretizeRegion[ir]
Volume[DiscretizeRegion[ir]]
yields: 9.91025.
This is larger than volume of ellipsoid (2,1,1) and is really fit of convex hull. This, again, is fitting ellipsoid by creating convex hull mesh from data points. The intent of the question may have been for more complex data sets in shape and convex hull may not be ideal.