Greetings, and a quick question: How do I plot the resultant of one model against the resultant of another

Hello All,

Brand new here, and somewhat new to R. I'm using Rstudio and I'm trying to make a prediction by correlating my data with my simulation data. I have a model based on the data of my experimental results, it's temperature vs time. I have another model from a simulation that has a temperature output as well. I'd like to plot Temperature(experimental results) vs Temperature(simulation) using the linear models I created rather than data points from the raw data.

If I could extract points from the model that would be good, but using the continuous output from the model would be more to my liking.

I appreciate any pointers


It is not clear to me how best to match up the output of experiment and the simulation but I will try to get you started.

If you used a built in fitting function like lm() to fit the experiment data, then you can use the predict() function to generate temperatures values at chosen time values. The form of the calculation would be

PredictTemp <- predict(YourModel, newdata = df)

where YourModel is the object that was returned by lm() and df is a data frame containing the Time values at which you want Temperatures.
If you can then get your simulation to produce Temperatures at those same Times, you can line up the two results and plot them against each other.

Hi I appreciate the advice! The simulation I'm running is at steady state, meaning we are looking at a temperature gradient, and the temperature is no longer changing over time.

The data is also at steady state, it appears to be fluctuating in a repeating wave pattern over time. The time interval we're looking at is small enough to show the wave pattern, however if we were to zoom out it would appear as a line.

I would like to see if there is a correlation between the wave pattern and the temperature vs distance so that I can apply the correlation to another simulation set that I know is incorrect.

The way I'm interpreting it is that the temperature from my data-collection may correspond to some distance from the steady state simulation. In this case, the simulation is telling us the temperature across a distance.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.