Predicting Pixel Intensity Based on Surrounding Pixels - r

I am trying to build a model that will try to predict the pixel intensity at a particular point based off of the surrounding pixel intensities. As of now, the only way that I can think of doing this is averaging out the points, but I really don't think this is the best option. Someone suggested I try to use auto-regressive models, ARIMA I think, but I am not very familiar with the program. Would this be an appropriate program to use for what I need, if not, does anyone have any other suggestions for what I could use to do this in R?

Have a look at the spatstat package: http://spatstat.github.io.
From the FAQ, it supports using pixel image as data.
You should then be able to run spatial autoregression using the spdep package https://cran.r-project.org/web/packages/spdep/index.html, in particular the lagsarlm function.

Related

How to reproduce this graphical explanation (a scatter plot) of how covariance works?

I found this graphical intuitive explanation of covariance:
32 binormal points drawn from distributions with the given covariances, ordered from most negative (bluest) to most positive (reddest)
The whole material can be found at:
https://stats.stackexchange.com/questions/18058/how-would-you-explain-covariance-to-someone-who-understands-only-the-mean
I would like to recreate this sort of graphical illustration in R, but I'm not sufficiently familiar with R's plotting tools. I don't even know where to start in order to get those colored rectangles between each pair of data points, let alone make them semi-transparent.
I think this could make a very efficient teaching tool.
The cor.rect.plot function in the TeachingDemos package makes plots similar to what is shown. You can modify the code for the function to make the plot even more similar if you desire.

Can I plot the SVM decision boundary for 3 features(in 3D space) using Scikit learn?

I am using scikit-learn to understand Support Vector Machines(SVM). I want to plot the decision boundary computed by SVM. The SVM uses 3 features. So the decision boundary must be drawn in 3D space. Is this possible using scikit-learn?
I could find only 2D plots of SVM decision boundary at the official website.
However I found links on stackoverflow which show this is possible using matlab and r. Is there a way in which I can achieve the same using scikit-learn?
You don't use scikit-learn to plot things in Python. You have to use another package, and if you check scikit-learn's examples, you will see they use matplotlib. You can create 3D plots with matplotlib, here is the tutorial. The usage is basically the same than in 2D, except you add an argument for the third dimension.
Another popular package you could use is mayavi, which was conceived especially for 3D plotting.

Minimum Curvature Gridding in R or QGIS?

I'm looking for a way to grid oceanographic spatial data using Minimum Curvature. It can be done in Surfer, but i'm look for OpenSource methods. Have looked in R and QGIS but no joy. Perhaps is buried in an R package somewhere? Can't see it in the 'spatial' package. Had no luck finding in GRASS either. Any ideas?
Thanks,
PB
How about Tps from the fields package? It fits thin plate splines which might be equivalent to minimum curvature...
Look at surfit - result is comparable with MINC. I can say more - the only difference is that MINC have special condition on the grid boundary, instead of surfit.

Hyperellipsoid confidence region

The R function ellipse() (package: ellipse) allows to generate the coordinates of confidence regions for two parameters. Does anyone know how to generate the coordinates of hyperellipsoid confidence regions for D>2 parameters?
If I understand your question, I think what you want is described in the "Introduction to rggobi" document which you can find with a search. They call it a graphical manova. I implemented it in 3D in the function makeEllipsein the package ChemoSpec. If you study that and related functions, I think you can extend it to more dimensions. You can see it in action by running the examples in plotScores3D or plotScoresRGL. Good luck.

Is there an interactive output device to view 3D graphs in R?

I'm currently generating 3D graphs in R using the persp-command. To change the viewpoint one has to set the parameters theta and phi. To evaluate (a good viewpoint on) the graph, one has to try lots of combinations for these parameters.
I was wondering if one can define an interactive output device that allows to rotate the graph using the mouse. It would be also nice if this device gives the current values for theta and phi.
Is there such a device/package?
See the rgl package: http://cran.r-project.org/web/packages/rgl/index.html
It won't report the theta and phi values you need, IIRC (though see #Dieter's comment below for a solution to this), but you can use rgl.snapshot() or rgl.postscript() to grab the current display as a bitmap or vector image. The package has persp3d() which is very similar to persp().
See the package rggobi http://cran.r-project.org/web/packages/rggobi/index.html
For data visualisation in 3 or even more dimensions, try the package rggobi which makes use of the program ggobi. It is possible to manipulate the data using the mouse, "brush" data, identify points in the data all while visualizing in a number of dimensions.

Resources