Using Generalized Additive Model to smooth the data
이전 댓글 표시
Hi, I have some data, which is light measured vs date, 24 measurements every day.
I would like to use Generalized Additive Model (GAM) to smooth the measurments to better integrates trend in my dataset.
Here is my dataset. Does anyone can help me how to use GAM to smooth my dataset?

댓글 수: 5
Konrad
2022년 9월 16일
DId you already take a look at RegressionGAM and/or fitrgam? Can you be more specific about where you're stuck?
Sahar khalili
2022년 9월 16일
Konrad
2022년 9월 19일
Well, if you don't have exact measurement time stamps, I would guess you have 1 data point / hour each day, for 360 days?! So just create your predictor variable 'time' yourself, e.g.:
t_hours = 1:24*360;
Sahar khalili
2022년 9월 19일
Konrad
2022년 9월 20일
Sounds like your (repsonse-) variable has the wrong data type ;)
The screenshot in your question indicates that your response variable 'P_surf' is of type cell. Try to convert it:
y1 = cell2mat(P_surf);
Your predictor (which has only 358 colums btw) seems to be of type 'datetime'. If fitgram() can't handle that, try to convert it using datenum().
If that does not solve the error, post the output of class(y1) and class(xData).
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
