Todolist RvsZ3
R Vs Z3 questions and to-do list
Reference document: R-intro.pdf
Reference wiki page: https://wiki.zcubes.com/RvsZ3
Topic 3 : Objects, their modes and attributes
1] Intrinsic attributes: mode and length
To do: -Need to add Z3 explanation for data frame
2] The class of an object
In R, unclass() removes temporarily the effects of class. For example if winter has the class "data.frame" then
> winter
will print it in data frame form, which is rather like a matrix, whereas
> unclass(winter)
will print it as an ordinary list.
To do: -Need to add equivalent Z3 command for unclass().
Topic 4: Ordered and unordered factors
1] A specific example:
To do:- Need to add equivalent Z3 command for levels()
2] The function tapply() and ragged arrays:
To do: - Need to add equivalent commands for tapply() for sample variance and standard error calculations
Topic 5: Arrays and matrices
1]Frequency tables from factors:
To do: - Need to add equivalent commands for table() in the example
Topic 9: Grouping, loops and conditional execution
1] Repetitive Execution:
In R,
coplot() function is used to print array of plots for respective object elements.
split() function produces a list of vectors obtained by splitting a larger vector according to the classes specified by a factor.
> repeat expr is a looping statement
> while (condition) expr is a looping statement
The break statement can be used to terminate any loop, possibly abnormally.
The next statement can be used to discontinue one particular cycle and skip to the “next”.
To do:- Need to add equivalent commands in Z3 for coplot(), split(), repeat, while, break, next.
Topic 11: Statistical Models in R
1]Linear Models:
The basic function for fitting ordinary multiple models is lm(), and a streamlined version of the call is as follows:
> fitted.model <- lm(formula, data = data.frame)
For example
> fm2 <- lm(y ~ x1 + x2, data = production)
would fit a multiple regression model of y on x1 and x2 (with implicit intercept term). The important (but technically optional) parameter data = production specifies that any variables needed to construct the model should come first from the production data frame. This is the case regardless of whether data frame production has been attached on the search path or not.
To do:-
What is equivalent command for lm() in Z3?
2] Contrasts: Contrasts can be used to make specific comparisons of treatments within a linear model. Factors are translated to a set of variables, one less than the number of levels of the factor (k-1).
In R, the default contrast is 'treatment' and is represented as:
options(contrasts = c("contr.treatment", "contr.poly"))
To do:-
to add Z3 command. Is this similar to INTERCEPT()?
3] Updating fitted models:
To do:- Need to add Z3 equivalent command for update() function
4] Generalised linear model:
To do:- Need to add Z3 equivalent description
5] The glm() function:
To do:- Need to add Z3 equivalent command for. Binomial, poisson, and quasi-likelihood models
6]Nonlinear least squares and maximum likelihood models:
To do:- Need to add Z3 equivalent command for optim(), nlm() and nlminb()
7]Some non-standard models:
To do:- Need to add Z3 equivalent description
Index vectors; selecting and modifying subsets of a data set
1] A vector of positive integral quantities:
The corresponding elements of the vector are selected and concatenated, in that order, in the result. In R, x[6] is the sixth component of x and
> x[1:10]
The same in Z3 command is:
x.any(10)- Need to check the Z3 command is equivalent to R
2]A vector of negative integral quantities:
Such an index vector specifies the values to be excluded rather than included. Thus
> y <- x[-(1:5)]
gives y all but the first five elements of x.
it is not showing the first five elements of x. It is just showing the result as numeric(0)
Z3 command to index vector specification is:
To do: Need to add the similar command for Z3
Lists and data frames
1]Components of lists may also be named,
> name$component_name
To do:- Need to add similar command for Z3
Constructing and modifying lists
2] New lists may be formed from existing objects by the function list(). An assignment of the form
> Lst <- list(name_1=object_1, ..., name_m=object_m)
3]> Lst[5] <- list(matrix=Mat)
To do:- Need to add similar command for Z3
Making data frames
4]A list whose components conform to the restrictions of a data frame may be coerced into a data frame using the function as.data.frame()
> accountants <- data.frame(home=statef, loot=incomes, shot=incomef)
To do:- Need to add similar command for Z3
attach() and detach()
5]To attach a database as a list or data frame as its argument we can use the function called attach() in R Thus suppose lentils is a data frame with three variables lentils$u, lentils$v,lentils$w.
> attach(lentils)
> attach(any.old.list)
To do:-
Need to add similar command for Z3
Managing the search path
6]> search() [1] ".GlobalEnv" "Autoloads" "package:base"
Also to detach the data frame and confirm it has been removed from the search path.
> detach("lentils") > search() [1] ".GlobalEnv" "Autoloads" "package:base"
To do:- Need to add similar command for Z3
Reading data from files 1] > HousePrice <- read.table("houses.data")
2]HousePrice <- read.table("houses.data", header=TRUE)
To do:-
Need to add similar command for Z3
The scan() function 1]> inp <- scan("input.dat", list("",0,0))
2]To separate the data items into three separate vectors, use assignments like
> label <- inp1; x <- inp2; y <- inp3
If the second argument is a single value and not a list, a single vector is read in, all components of which must be of the same mode as the dummy value.
> X <- matrix(scan("light.dat", 0), ncol=5, byrow=TRUE)
To do:-
Need to add similar command for Z3
3]data()
As from R version 2.0.0 all the datasets supplied with R are available directly by name.
4]data(package="rpart")
data(Puromycin, package="datasets")
To do:-
Need to add similar command for Z3
Probability distributions
1] > long <- eruptions[eruptions > 3]
> plot(ecdf(long), do.points=FALSE, verticals=TRUE)
> x <- seq(3, 5.4, 0.01)
> lines(x, pnorm(x, mean=mean(long), sd=sqrt(var(long))), lty=3)
To do:-
Need a equivalent commands for Z3
2]x <- rt(250, df = 5)
qqnorm(x); qqline(x)
3]qqplot(qt(ppoints(250), df = 5), x, xlab = "Q-Q plot for t dsn")
qqline(x)
To do:-
Need a equivalent commands for Z3
Shapiro-Wilk normality test
Need to know any similar distribution do we have for Z3.
Graphical Procedures To Do:-
Is there any commands like High plotting, Low-level plotting, Interactive graphics and plot function?
1]> pairs(X)
2]> coplot(a ~ b | c)
3]> coplot(a ~ b | c + d)
4]qqnorm(x)
qqline(x)
qqplot(x, y) -Distribution-comparison plots.
hist(x)
hist(x, nclass=n)
hist(x, breaks=b, ...) - Produces a histogram of the numeric vector x.
dotchart(x, ...) - Constructs a dotchart of the data in x.
image(x, y, z, ...)
contour(x, y, z, ...)
persp(x, y, z, ...) - Plots of three variables
To Do:- Need to update for Z3
5]Is there any Set of Arguments to high-level plotting function commands are available in Z3?
6]Need to know the following set of commands available for Z3 (i)Mathematical annotation
(ii)Hershey vector fonts
(iii)Interacting with graphics
(iv)The par() function
(v)Arguments to graphics functions
(vi)Graphical elements
(vii)Axes and tick marks
(viii)Figure margins
(ix)Multiple figure environment
In Device drivers:
- PostScript diagrams for typeset documents
- Multiple graphics device
- Dynamic graphics