Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theil-Sen Trend Analysis #378

Open
morshedahmed17 opened this issue Feb 21, 2024 · 5 comments
Open

Theil-Sen Trend Analysis #378

morshedahmed17 opened this issue Feb 21, 2024 · 5 comments
Labels
question Questions about function use or interpretation

Comments

@morshedahmed17
Copy link

Question

I removed some months from the dataset for the Theil-Sen trend analysis, which I do not want to show in the plot. However, those points still appear in the plots, not exactly where they were before. Is it possible to remove them completely? Also, is it possible to remove the line joining the points?

@morshedahmed17 morshedahmed17 added the question Questions about function use or interpretation label Feb 21, 2024
@jack-davison
Copy link
Collaborator

Hi,

We'd be able to best help you if you can provide a reproducible example.

TheilSen() should only plot the data you use as an input, e.g.,:

library(openair)

alldata <- mydata

TheilSen(alldata, "nox")
#> Taking bootstrap samples. Please wait.

lessdata <- selectByDate(mydata, year = 2000:2002)

TheilSen(lessdata, "nox")
#> Taking bootstrap samples. Please wait.

Created on 2024-02-21 with reprex v2.0.2

More than happy to help if you can provide more info!

Jack

@morshedahmed17
Copy link
Author

Hello Jack,

Here is an example. I removed the entire 2012 ethane data. However, the monthly values are still showing in the plot.

image

@mooibroekd
Copy link

When using the "deseason" option missing data is actually imputed using a Kalman filter and a Kalman smooth prior to doing the loess.

In other words, that is the probably the reason why the missing data is there. Quickest way to test is by setting "deseason" to FALSE.

@morshedahmed17
Copy link
Author

You are right. Just one quick question.

"If I set 'deaseason = FALSE', will the resulting trendline simply be a regression line?"

@mooibroekd
Copy link

No, the output will still be a Theil-Sen analysis, but on data that has not been deseasonalized (meaning actual measurements).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions about function use or interpretation
Projects
None yet
Development

No branches or pull requests

3 participants