Question: need a help in Transform the Data, can you please help in correcting my below code Question 2 - Transform the Data ################################ I <
need a help in Transform the Data, can you please help in correcting my below code
Question Transform the Data
################################
I c# Choose any four X variables and Y
headdatasubset
variablesfortransform datasubsetI # obtain a by matrix
# Initialize transformed data matrix
data.transformed variablesfortransform
headdatatransformed
# for each variable, you need to figure out a good data transformation method,
# such as Polynomial, log and negation transformation. The kS test and Skewness
# calculation may be helpful to select the transformation method
p# for example, using pto transform the first variable. You should change p based on your distribution.
data.transformedvariablesfortransformp # Power transformation for Citric Acid weak positive correlation
data.transformedlogvariablesfortransform # Log transformation for Chlorides negative correlation
data.transformedvariablesfortransform # Negation for Total Sulfur Dioxide negative correlation
data.transformedvariablesfortransformp # Power transformation for pH no clear relationship
#data.transformedvariablesfortransform #alcohol variable will not undergo any transformation egpower logor negationsince it already has a clear positive correlation with the target variable quality
# A MinMax andor Zscore transformation should then be used to adjust the scale of each variable
# minmax normalisation
minmax functionx
x minxmaxxminx
# zscore standardisation and scaling to unit interval
unit.z functionx
xmeanxsdx
# Apply scaling
data.transformedminmaxdatatransformed # MinMax for Citric Acid
data.transformedunitzdatatransformed # ZScore for Chlorides
data.transformedminmaxdatatransformed # MinMax for Total Sulfur Dioxide
data.transformedunitzdatatransformed # ZScore for pH
#data.transformedminmaxdatatransformed # MinMax for Quality
# Save this transformed data to a text file
write.tabledatatransformed, "testtransformed.txt
can you help in transformation? I am not getting what i am doing wrong here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
