I want to determine the influence of factors on the outcome of a situation using LinearModelFit
. I've tried to figure out how to do it by looking at online examples but I'm getting nowhere.
For example, taking the following data (these are completely made up values):
So I want to calculate the influence the four factors (time, rain, humidity, no. plants) have on the overall flower growth (row 6).
I know how to import the data and put it into table form but after that I get lost.
Can someone show me how I would make this into a LinearModelFit
and finally a ParameterTable
which shows me the influence of each factor.
Out of curiousity, are there other ways of indicating the impact of factors?
Edit:
I have tried to implement the classifier method, I believe I have got the first phase of the classifier training method but I'm not sure where to go from here since I'm using my own data set and not ExampleData.
flowertab = SemanticImport["https://s3.us-east-2.amazonaws.com/flowername1/flower1.xlsx"]
flowerflow = Normal@flowertab[All, Sequence[Most@# -> Last@#] &]
How to I apply my data to the titanic method:
testSetName = "Titanic";
trainingSet =
ExampleData[{"MachineLearning", testSetName}, "TrainingData"];
testSet = ExampleData[{"MachineLearning", testSetName}, "TestData"];
varNames =
Flatten[List @@
ExampleData[{"MachineLearning", testSetName},
"VariableDescriptions"]];
mres = Association@Map[
Function[{clMethod},
cf = Classify[trainingSet, Method -> clMethod];
accRes =
AccuracyByVariableShuffling[cf, testSet, varNames,
"FScoreLabels" -> "survived"];
clMethod -> (accRes[None] - Rest[accRes])/accRes[None]
], {"LogisticRegression", "NearestNeighbors", "NeuralNetwork",
"RandomForest", "SupportVectorMachine"}] ;
Dataset[mres]
to finally get
mres = Association@Map[
Function[{clMethod},
cf = Classify[trainingSet, Method -> clMethod];
accRes =
AccuracyByVariableShuffling[cf, testSet, varNames,
"FScoreLabels" -> "survived"];
clMethod -> (accRes[None] - Rest[accRes])/accRes[None]
], {"LogisticRegression", "NearestNeighbors", "NeuralNetwork",
"RandomForest", "SupportVectorMachine"}] ;
Dataset[mres]
Classify
and this guide for variables importance investigation. Also, see the related discussion "How can I determine the importance of variables from Classify?". $\endgroup$LinearModelFit
documentation for"CookDistances"
. $\endgroup$