Computing missing values with linear fit

조회 수: 3 (최근 30일)
Felix Ja
Felix Ja 2021년 8월 11일
댓글: Felix Ja 2021년 8월 11일
Hi Guys.
I've got two Vectors, one has some missing values. After plotting both against each other an creating a linear fit/regression I want to calculate the missing values.
My MATLAB Version is 2017b i think.
Best
Felix
  댓글 수: 2
the cyclist
the cyclist 2021년 8월 11일
편집: the cyclist 2021년 8월 11일
It might be helpful for you to upload your data here in a MAT file, for us to take a look.
Are the missing values in the explanatory variable ("x") or in the response variable ("y")?
Do you have the Statistics and Machine Learning Toolbox?
Felix Ja
Felix Ja 2021년 8월 11일
I'm using a remotedesktop on which are my data.
The respones "y"-Varbiable is missing

댓글을 달려면 로그인하십시오.

답변 (1개)

the cyclist
the cyclist 2021년 8월 11일
% Set the random number generator seed, for reproducibility
rng default
% Make up some pretend data
N = 10;
x = (1:N)';
y = 2*x + 0.3*randn(N,1);
% Make a couple y values missing
missingIndex = [2 7];
y(missingIndex) = NaN;
% Fit the data
mdl = fitlm(x,y)
% Get the predicted values for the missing y values
y_missing_predicted = predict(mdl,x(missingIndex))
  댓글 수: 1
Felix Ja
Felix Ja 2021년 8월 11일
thanks, i try to ue this and write you again, if nessesary.
Cheers

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by